State: MetabaseUpdateObjectApplyState;
The State property determines a state of readiness of an object to update.
Executing the example requires the update file Update.pef in the root of disc C.
Sub Main;
Var
MB: IMetabase;
MU: IMetabaseUpdate;
Root: IMetabaseUpdateFolderNode;
Node: IMetabaseUpdateNode;
i: Integer;
Begin
MB := MetabaseClass.Active;
MU := MB.CreateUpdate;
MU.LoadFromFile("c:\Update.pef");
MU.Prepare;
Root := MU.RootFolder;
For i := 0 To Root.Count - 1 Do
Node := Root.Item(i);
If Node.NodeType = MetabaseUpdateNodeType.Object Then
ObjectNode := Node As IMetabaseUpdateObjectNode;
State := ObjectNode.ApplyState;
Select Case State.State
Case MetabaseUpdateObjectApplyState.CreateNew:
Debug.WriteLine("Object of update: " + ObjectNode.ObjectId + "; State: Create new");
Case MetabaseUpdateObjectApplyState.EditExisting:
Debug.WriteLine("Object of update: " + ObjectNode.ObjectId + "; State: Update existent.");
Case MetabaseUpdateObjectApplyState.Conflict Or MetabaseUpdateObjectApplyState.ConflictKey:
Debug.WriteLine("Object of update: " + ObjectNode.ObjectId + "; State: Conflict. An object exists with the similar key.");
Case MetabaseUpdateObjectApplyState.Conflict Or MetabaseUpdateObjectApplyState.ConflictId:
Debug.WriteLine("Object of update: " + ObjectNode.ObjectId + "; State: Conflict. An object exists with the similar identifier.");
Case MetabaseUpdateObjectApplyState.Conflict Or MetabaseUpdateObjectApplyState.ConflictClassId:
Debug.WriteLine("Object of update: " + ObjectNode.ObjectId + "; State: Conflict. Existent object has different class.");
Case MetabaseUpdateObjectApplyState.Conflict Or MetabaseUpdateObjectApplyState.ConflictObjectNotFound:
Debug.WriteLine("Object of update: " + ObjectNode.ObjectId + "; State: Conflict. Repository object for which update type Only update is assigned is not found.");
Case MetabaseUpdateObjectApplyState.Conflict Or MetabaseUpdateObjectApplyState.ConflictMissingMetadata:
Debug.WriteLine("Object of update: " + ObjectNode.ObjectId + "; State: Conflict. In update metadata are absent to create an object.");
End Select;
End If;
End For;
End Sub Main;
After executing this example the update file Update.pef is downloaded and checked. For objects that contain update and relevant repository object in a root the state of readiness to update is displayed in the development environment console.
See also: