OnUpdateObject(Update: IMetabaseUpdate; CurrentNode: IMetabaseUpdateNode; Var Skip: Boolean);
Update - update used in current repository.
CurrentNode - object of update that is applied to repository object.
Skip - parameter that determines whether the object is updated. Default value is False, at the same time the object is updated.
If the parameter value is True, the object that corresponds to the object CurrentNode is not updated. The object is ignored.
The OnUpdateObject method implements an event that appears directly before updating of repository object that corresponds to the update object CurrentNode.
Public Class CUpdateEvents: UpdateEvents
Public Sub OnBeginUpdate(Update: IMetabaseUpdate);
Var
Flag: IMetabaseUpdateProperty;
Begin
Debug.WriteLine("Update of repository objects");
Flag := Update.Properties.FindById("Ver");
If Flag <> Null Then
Flag.Value := "1.1";
End If;
End Sub OnBeginUpdate;
Public Sub OnAskConstraintsHandling(Update: IMetabaseUpdate; Node: IMetabaseUpdateNode;
Details: String;
Var Handling: UpdateDataConstraintsHandlingType);
Begin
Handling := UpdateDataConstraintsHandlingType.KeepTableUnchanged;
End Sub OnAskConstraintsHandling;
Public Sub OnAskReflectRights(Var Cancel: Boolean);
Begin
Cancel := True;
End Sub OnAskReflectRights;
Public Sub OnUpdateObject(Update: IMetabaseUpdate; CurrentNode: IMetabaseUpdateNode; Var Skip: Boolean);
Begin
If CurrentNode.NodeType = MetabaseUpdateNodeType.DeleteObject Then
Skip := True;
End If;
End Sub OnUpdateObject;
Public Sub OnEndUpdate(Update: IMetabaseUpdate);
Begin
Debug.WriteLine("Update of objects is completed");
End Sub OnEndUpdate;
End Class CUpdateEvents;
This example is a template for update module. On applying of update that contains this module the following checks are performed:
If update contains a flag of update with the Ver identifier, a value "1.1" is assigned for this flag. Only those objects for that a condition of update equals "Ver=1.1" are updated.
On failure of data integrity the update of the whole object is ignored.
Updating permissions to objects, for which it is necessary will be performed only on the platform level.
In update elements that delete repository objects are ignored.
See also: