Kernel SDK Developer's Guide > Common Data Access > Requirements of the Database for using CDA
Requirements of the Database for using CDA

To create a hierarchical structure using the Common Data Access API, a database must have the following set of properties and attributes:

  • Hierarchical tree nodes can have the ODAUniqueID property with a value of the OdUInt64 type. In this case, ODAUniqueID is used to link a tree node with visualization geometry.
  • All objects required in the hierarchical tree must either have a property with the HierarchyLevel attribute or they must be included in the CollectionProperty of the parent object. This property must contain a reference to a child object (or objects of the CollectionProperty type). It is recommended to exclude unnecessary or service objects.
  • If the object has nested objects, the property should have the CollectionProperty type and return an array of references to these nested objects.
  • The HierarchyLevel attribute can be set to the following values: Database, Model, BlockReference, Block, Entity, Hidden. It is recommended to set the attribute based on the following criteria:
    • Entity — A leaf element of a hierarchical tree.
    • Block — A set of elements of the hierarchical structure that can be used in the tree several times.
    • BlockReference — An element that serves as a reference to the hierarchical element of the Block type.
    • Model — A set of elements of a hierarchical structure, which can be separated logically in the hierarchical tree.
    • Database — An element that contains a reference to an external database.
    • Hidden — A utility element that has no significant properties and can be hidden when displaying the tree in viewer applications.
  • In most cases, to determine the object type by its ID, it is necessary to inherit it from the OdRxHierarchyLevelAttribute class and override the following function: virtual OdString value(OdRxValue& value);.
  • It is recommended that the DisplayAsAttribute property for the objects involved in the formation of the hierarchical tree and the property cache do not return an empty string.

For example:

A database object contains a property of the model of the CollectionProperty type with the HierarchyLevel attribute. The value of this attribute is Model. This property contains a collection of references to the objects, that is, model objects. Each model object contains an Entity property of the CollectionProperty type with the HierarchyLevel attribute. The value of the attribute is Entity. To determine the exact type of the item, the overloaded function virtual OdString value(OdRxValue& value); of the OdRxHierarchyLevelAttribute class is required.

See Also

Common Data Access

Copyright © 2002 – 2020. Open Design Alliance. All rights reserved.