State: MetabaseUpdateObjectApplyState;
The State property determines a state of readiness of an object for update.
Executing the example requires the update file Update.pef in the root of the C disc.
Sub UserProc;
Var
MB: IMetabase;
MU: IMetabaseUpdate;
Root: IMetabaseUpdateFolderNode;
Node: IMetabaseUpdateNode;
i, c: Integer;
Begin
MB := MetabaseClass.Active;
MU := MB.CreateUpdate;
MU.LoadFromFileNF("c:\Update.pefx");
MU.Prepare;
Root := MU.RootFolder;
c := Root.Count;
For i := 0 To c - 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("Update object: " + ObjectNode.ObjectId + "; Status: Creating a new one");
Case MetabaseUpdateObjectApplyState.EditExisting:
Debug.WriteLine("Update object: " + ObjectNode.ObjectId + "; Status: Updating an existing one.");
Case MetabaseUpdateObjectApplyState.Conflict Or MetabaseUpdateObjectApplyState.ConflictKey:
Debug.WriteLine("Update object: " + ObjectNode.ObjectId + "; Status: Conflict. The object with the same key already exists.");
Case MetabaseUpdateObjectApplyState.Conflict Or MetabaseUpdateObjectApplyState.ConflictId:
Debug.WriteLine("Update object: " + ObjectNode.ObjectId + "; Status: Conflict. The object with the same identifier already exists.");
Case MetabaseUpdateObjectApplyState.Conflict Or MetabaseUpdateObjectApplyState.ConflictClassId:
Debug.WriteLine("Update object: " + ObjectNode.ObjectId + "; Status: Conflict. The existing object has another class.");
Case MetabaseUpdateObjectApplyState.Conflict Or MetabaseUpdateObjectApplyState.ConflictObjectNotFound:
Debug.WriteLine("Update object: " + ObjectNode.ObjectId + "; Status: Conflict. The repository object, which has the Update Only type.");
Case MetabaseUpdateObjectApplyState.Conflict Or MetabaseUpdateObjectApplyState.ConflictMissingMetadata:
Debug.WriteLine("Update object: " + ObjectNode.ObjectId + "; Status: Conflict. The update does not contain the metadata for creating the object.");
End Select;
End If;
End For;
End Sub UserProc;
After executing the example the update file is downloaded and checked. For objects contained in the update root folder and corresponding repository objects the state of readiness for update is displayed in the development environment console.
See also: