ObjectId: String;
The ObjectId property determines an identifier of the updated object.
By default, a property value corresponds to an object identifier added to the update from the repository. Value of this property can be changed to change identifier of the updated object, or to update another object if the update type by identifier is used.
Public Class CUpdateEvents: UpdateEvents
Public Sub OnBeginUpdate(Update: IMetabaseUpdate);
Begin
Debug.WriteLine("Repository objects update start");
End Sub OnBeginUpdate;
Public Sub OnBeforeApplyUpdate(Update: IMetabaseUpdate);
Var
MB: IMetabase;
Root: IMetabaseUpdateFolderNode;
Node: IMetabaseUpdateNode;
ObjectNode: IMetabaseUpdateObjectNode;
i: Integer;
Begin
MB := MetabaseClass.Active;
If MB.Security.Policy.ObjectsIdFormat <> "" Then
Root := Update.RootFolder;
For i := 0 To Root.Count - 1 Do
Node := Root.Item(i);
If Node.NodeType = MetabaseUpdateNodeType.Object Then
ObjectNode := Node As IMetabaseUpdateObjectNode;
ObjectNode.ObjectId := MB.GenerateId(ObjectNode.ObjectId);
End If;
End For;
End If;
End Sub OnBeforeApplyUpdate;
Public Sub OnEndUpdate(Update: IMetabaseUpdate);
Begin
Debug.WriteLine("Object update is finished");
End Sub OnEndUpdate;
End Class CUpdateEvents;
This example is a template for update unit. Before update application, the presence of a set identifiers formatting in the repository will be audited. If identifiers formatting is set, new identifiers will be generated according to this formatting for root update objects that correspond to repository objects.
See also: