OnSkip(Data: IMetabaseUpdateProgressData);
OnSkip(Data: Prognoz.Platform.Interop.Metabase.IMetabaseUpdateProgressData);
Data - the information about synchronization progress.
The OnSkip method implements the event of skipping the update element on updating.
To execute the example, add a link to the Metabase system assembly. The C:\Update.pefx update file is required.
<span style="font-family: 'Courier New'; font-size: 9pt;"><font color="#008080">Sub</font> Main;<br /> <font color="#008080">Var</font><br /> Mb: IMetabase;<br /> Upd: IMetabaseUpdate;<br /> Progress: MyUpdateProgress;<br /> <font color="#008080">Begin</font> <br /> MB := MetabaseClass.Active;<br /> Upd := Mb.CreateUpdate;<br /> Upd.LoadFromFileNF(<font color="#800000">"D:\Update.pefx"</font>);<br /> Progress := <font color="#008080">New</font> MyUpdateProgress.Create(Upd);<br /> Upd.Apply(Progress);<br /> Upd.SaveToFileNF(<font color="#800000">"D:\Update.pefx"</font>);<br /> <font color="#008080">End</font> <font color="#008080">Sub</font> Main;<br /> <br /> <font color="#008080">Public</font> <font color="#008080">Class</font> MyUpdateProgress: UpdateProgress<br /> update: IMetabaseUpdate;<br /> <br /> <font color="#008080">Public</font> <font color="#008080">Constructor</font> Create(update_ : IMetabaseUpdate);<br /> <font color="#008080">Begin</font><br /> update := update_;<br /> <font color="#008080">End</font> <font color="#008080">Constructor</font> Create;<br /> <br /> <font color="#008080">Public</font> <font color="#008080">Sub</font> OnProgress(Data: IMetabaseUpdateProgressData);<br /> <font color="#008080">Var</font> ObjectNode : IMetabaseUpdateObjectNode;<br /> <font color="#008080">Begin</font><br /> <font color="#008080">Select</font> <font color="#008080">Case</font> Data.Stage<br /> <font color="#008080">Case</font> MetabaseUpdateProgressStage.Start: <br /> Debug.WriteLine(<font color="#800000">"Start of updating objects"</font>);<br /> Debug.WriteLine(<font color="#800000">"log of update conflicts:"</font>);<br /> Debug.WriteLine(update.SecurityConflictsLog);<br /> <font color="#008080">Case</font> MetabaseUpdateProgressStage.Prepare: Debug.WriteLine(<font color="#800000">"Object preparation"</font>);<br /> <font color="#008080">Case</font> MetabaseUpdateProgressStage.Apply: Debug.WriteLine(<font color="#800000">"Object updating"</font>);<br /> <font color="#008080">Case</font> MetabaseUpdateProgressStage.AfterApply: <br /> <font color="#008080">If</font> Data.Node <font color="#008080">Is</font> IMetabaseUpdateObjectNode <font color="#008080">Then</font><br /> Debug.WriteLine(<font color="#800000">"Object is saved"</font>);<br /> ObjectNode:= Data.Node <font color="#008080">As</font> IMetabaseUpdateObjectNode;<br /> Debug.WriteLine(<font color="#800000">"log of permission changes:"</font>);<br /> Debug.WriteLine(ObjectNode.SDApplyLog);<br /> <font color="#008080">End</font> <font color="#008080">If</font>; <br /> <font color="#008080">Case</font> MetabaseUpdateProgressStage.Finish: Debug.WriteLine(<font color="#800000">"Updating objects is completed"</font>);<br /> <font color="#008080">End</font> <font color="#008080">Select</font>;<br /> Debug.WriteLine(<font color="#800000">"Current "</font> + Data.Current.ToString + <font color="#800000">" from "</font> + Data.Total.ToString + <font color="#800000">" Object "</font> + Data.Node.Label);<br /> <font color="#008080">End</font> <font color="#008080">Sub</font> OnProgress;</span>
Public Sub OnSkip(Data: IMetabaseUpdateProgressData);
Begin
Debug.WriteLine("OnSkip " + Data.Node.Label);
End Sub OnSkip;
End Class MyUpdateProgress;
After executing the example, the console window displays the information about the update process, the log of update conflicts and the log of changing permissions.
To execute the example, add a link to the Metabase system assembly. The C:\Update.pefx update file is required.
Due to the fact that Fore.NET does not include the UpdateProgress class, this example is executed by using the UpdateProgress custom class, which is inherited from the IMetabaseUpdateProgress interface.
<font color="#008080">Sub</font> Main(Params: StartParams);<br /> <font color="#008080">Var</font><br /> Mb: IMetabase;<br /> Upd: IMetabaseUpdate;<br /> Progress: UpdateProgress;<br /> <font color="#008080">Begin</font> <br /> MB := Params.Metabase;<br /> Upd := Mb.CreateUpdate();<br /> Upd.LoadFromFileNF(<font color="#800000">"D:\"</font>+ <font color="#800000">"Update.pefx"</font>,UpdateLoadMode.ulmReplace);<br /> Progress := <font color="#008080">New</font> UpdateProgress.Create(Upd);<br /> Upd.Apply(Progress);<br /> Upd.SaveToFileNF(<font color="#800000">"D:\"</font>+ <font color="#800000">"Update.pefx"</font>);<br /> <font color="#008080">End</font> <font color="#008080">Sub</font> Main;<br /> <br /> <font color="#008080">Public</font> <font color="#008080">Class</font> UpdateProgress: IMetabaseUpdateProgress<br /> <br /> update: IMetabaseUpdate;<br /> <br /> <font color="#008080">Public</font> <font color="#008080">Constructor</font> Create(update_ : IMetabaseUpdate);<br /> <font color="#008080">Begin</font><br /> update := update_;<br /> <font color="#008080">End</font> <font color="#008080">Constructor</font> Create;<br /> <br /> <font color="#008080">Public</font> <font color="#008080">Sub</font> OnProgress(Data: IMetabaseUpdateProgressData);<br /> <font color="#008080">Var</font> ObjectNode : IMetabaseUpdateObjectNode;<br /> <font color="#008080">Begin</font><br /> <font color="#008080">Select</font> <font color="#008080">Case</font> Data.Stage<br /> <font color="#008080">Case</font> MetabaseUpdateProgressStage.mupsStart: <br /> System.Diagnostics.Debug.WriteLine(<font color="#800000">"Start of updating objects"</font>);<br /> System.Diagnostics.Debug.WriteLine(<font color="#800000">"log of conflicts of update:"</font>);<br /> System.Diagnostics.Debug.WriteLine(update.SecurityConflictsLog);<br /> <font color="#008080">Case</font> MetabaseUpdateProgressStage.mupsPrepare: System.Diagnostics.Debug.WriteLine(<font color="#800000">"Object preparation"</font>);<br /> <font color="#008080">Case</font> MetabaseUpdateProgressStage.mupsApply: System.Diagnostics.Debug.WriteLine(<font color="#800000">"Updating object"</font>);<br /> <font color="#008080">Case</font> MetabaseUpdateProgressStage.mupsAfterApply: <br /> <font color="#008080">If</font> Data.Node <font color="#008080">Is</font> IMetabaseUpdateObjectNode <font color="#008080">Then</font><br /> System.Diagnostics.Debug.WriteLine(<font color="#800000">"Oblect is saved"</font>);<br /> ObjectNode:= Data.Node <font color="#008080">As</font> IMetabaseUpdateObjectNode;<br /> System.Diagnostics.Debug.WriteLine(<font color="#800000">"log of permissions changes:"</font>);<br /> System.Diagnostics.Debug.WriteLine(ObjectNode.SDApplyLog);<br /> <font color="#008080">End</font> <font color="#008080">If</font>; <br /> <font color="#008080">Case</font> MetabaseUpdateProgressStage.mupsFinish: System.Diagnostics.Debug.WriteLine(<font color="#800000">"Updating of objects is completed"</font>);<br /> <font color="#008080">End</font> <font color="#008080">Select</font>;<br /> System.Diagnostics.Debug.WriteLine(<font color="#800000">"Current "</font> + Data.Current.ToString() + <font color="#800000">" from "</font> + Data.Total.ToString() + <font color="#800000">" Object "</font> + Data.Node.Label);<br /> <font color="#008080">End</font> <font color="#008080">Sub</font> OnProgress;<br /> <br /> <font color="#008080">Public</font> <font color="#008080">Sub</font> OnError(Data: IMetabaseUpdateProgressData; <font color="#008080">Var</font> Ignore: Boolean);<br /> <font color="#008080">Begin</font><br /> System.Diagnostics.Debug.WriteLine(<font color="#800000">"Update object synchronization error '"</font> + Data.Node.Label + <font color="#800000">"'"</font>);<br /> System.Diagnostics.Debug.WriteLine(<font color="#800000">"Text of error: "</font> + Data.Error.Message);<br /> <font color="#008080">If</font> Data.Object <> <font color="#008080">Null</font> <font color="#008080">Then</font><br /> System.Diagnostics.Debug.WriteLine(<font color="#800000">"Source of error: "</font> + Data.Object.Id);<br /> System.Diagnostics.Debug.WriteLine(<font color="#800000">"Object key: "</font> + Data.Object.Key.ToString());<br /> <font color="#008080">End</font> <font color="#008080">If</font>;<br /> System.Diagnostics.Debug.WriteLine(<font color="#800000">"The object will be skipped"</font>);<br /> Ignore := <font color="#008080">True</font>;<br /> <font color="#008080">End</font> <font color="#008080">Sub</font> OnError;<br /> <br /> <font color="#008080">Public</font> <font color="#008080">Sub</font> OnSkip(Data: IMetabaseUpdateProgressData);<br /> <font color="#008080">Begin</font><br /> System.Diagnostics.Debug.WriteLine(<font color="#800000">"OnSkip "</font> + Data.Node.Label);<br /> <font color="#008080">End</font> <font color="#008080">Sub</font> OnSkip;<br /> <br /> <font color="#008080">Public</font> <font color="#008080">Sub</font> OnAskConstraintsHandling(Node: IMetabaseUpdateNode; Details: String; <font color="#008080">Var</font> Handling: UpdateDataConstraintsHandlingType);<br /> <font color="#008080">Begin</font><br /> Handling := UpdateDataConstraintsHandlingType.udchtKeepTableUnchanged;<br /> <font color="#008080">End</font> <font color="#008080">Sub</font> OnAskConstraintsHandling;<br /> <br /> <font color="#008080">Public</font> <font color="#008080">Sub</font> OnAskReflectRights(<font color="#008080">Var</font> Cancel: Boolean);<br /> <font color="#008080">Begin</font><br /> Cancel := <font color="#008080">True</font>;<br /> <font color="#008080">End</font> <font color="#008080">Sub</font> OnAskReflectRights;<br /> <br /> <font color="#008080">Public</font> <font color="#008080">Sub</font> OnResolve(Node: IMetabaseUpdateNode; Resolver: IMetabaseUpdateResolver);<br /> <font color="#008080">Var</font><br /> Unresolv: IMetabaseUpdateUnresolved;<br /> i: Integer;<br /> <font color="#008080">Begin</font><br /> System.Diagnostics.Debug.WriteLine(<font color="#800000">"OnResolve"</font>);<br /> <font color="#008080">For</font> i := <font color="#008000">0</font> <font color="#008080">To</font> Resolver.Count - <font color="#008000">1</font> <font color="#008080">Do</font><br /> <font color="#008080">If</font> Unresolv.ClassId = <font color="#008000">2822</font> <font color="#008080">Then</font><br /> Unresolv := Resolver.Item[i];<br /> System.Diagnostics.Debug.WriteLine(<font color="#800000">"Id: "</font> + Unresolv.Id);<br /> System.Diagnostics.Debug.WriteLine(<font color="#800000">"Name: "</font> + Unresolv.Name);<br /> System.Diagnostics.Debug.WriteLine(<font color="#800000">"Key: "</font> + Unresolv.Key.ToString());<br /> System.Diagnostics.Debug.WriteLine(<font color="#800000">"Description: "</font> + Unresolv.Description);<br /> System.Diagnostics.Debug.WriteLine(<font color="#800000">"KeepResolve: "</font> + Unresolv.KeepResolve.ToString());<br /> <font color="#008080">End</font> <font color="#008080">If</font>;<br /> <font color="#008080">End</font> <font color="#008080">For</font>;<br /> <font color="#008080">End</font> <font color="#008080">Sub</font> OnResolve;<br /> <br /> <font color="#008080">End</font> <font color="#008080">Class</font> UpdateProgress;
After executing the example, the console window displays the information about the update process, the log of update conflicts and the log of changing permissions.
See also: