MetaClassInfo Class
The IMetaClassInfo interface is used to create, read, modify or delete a CMetaClassDesc object. However, after the object has been created and its properties set to whatever values are appropriate, it is added to the MDS repository through the IMetaModelInfo::AddClass routine with this object as that routine's parameter. This means that all the “put” properties below are only setting in-memory values and as far as the MDS repository goes, they are useful only before a call to AddClass or to this class’s Update routine.
See Chapter 12: “AIM Classes” for more detailed information.
Property |
Type |
Description |
Common Properties |
|
|
PropertyList |
IMetaPropertyInfoList |
The list of all property descriptions for this class (read only). |
RelationshipList |
IMetaRelationshipInfoList |
The list of all relationship descriptions associated with this class (read only). |
UniqueNaming |
Boolean |
True or false to notify the engine to enforce (or not) unique names for the objects within this class. |
RootClass |
Boolean |
The type of class description. |
BaseClassID |
Long |
For derived classes, this is the object ID of the base class. Setting this property marks this class as a derived class. |
ObjectDescReq |
Boolean |
Set to TRUE (VARIANT_TRUE=-1) to have all objects created in this class to have a non-NULL Description property. The default is FALSE (VARIANT_FALSE), which allows objects in the class to have a NULL value for the Description property. |
AbstractClass |
Boolean |
This is a VARIANT_BOOL indicating whether or not the class is an abstract class. |
SuperClassList |
IMetaInfoKeyList |
This is a list of user-defined super-classes for this class. It can be empty if there are none. |
SubClassList |
IMetaInfoKeyList |
This is a read-only property that returns the list of sub-classes of this class, that is, those classes for which this class is a super-class. It will be empty if there are none. |
Common Properties
See “Common Properties” on page 349.
get_PropertyList
Purpose:
Gets the list of MetaPropertyInfo objects for the class.
Requirements:
Must be proceeded by a "Read(VARIANT_TRUE);" or else the list will be empty.
Syntax:
HRESULT get_PropertyList(
[out, retval] IMetaPropertyInfoList **pVal);
get_RelationshipList
Purpose:
Gets the list of MetaRelationshipInfo objects for the class.
Requirements:
Must be proceeded by a “Read(VARIANT_TRUE);” or else the list will be empty.
Syntax:
HRESULT get_RelationshipList(
[out, retval] IMetaRelationshipInfoList **pVal);
get_ UniqueNaming
Purpose:
Returns the Unique Naming property for the class.
Syntax:
HRESULT get_ UniqueNaming (
[out, retval] VARIANT_BOOL *pVal);
put_ UniqueNaming
Purpose:
Sets the Unique Naming property for the class.
Syntax:
HRESULT put_ UniqueNaming (
[in] VARIANT_BOOL newVal);
get_RootClass
Purpose:
Returns true if the class is a root class for the model.
Syntax:
HRESULT get_RootClass(
[out, retval] VARIANT_BOOL *pVal);
put_RootClass
Purpose:
Sets the root class value. (True = root class)
Syntax:
HRESULT put_RootClass([in] VARIANT_BOOL newVal);
get_BaseClassID
Purpose:
Returns the base class's object ID if this is a derived class (0 if not).
Syntax:
HRESULT get_BaseClassID(
[out, retval] long *pVal);
put_ BaseClassID
Purpose:
Sets the object ID of the base class, making this class a derived class.
Syntax:
HRESULT put_BaseClassID([in] long newVal);
AddProperty
Purpose:
Use this method to add a property description to the class description.
Requirements:
The class description must be already created in the MDS repository.
Syntax:
HRESULT AddProperty(
[in] IMetaPropertyInfo *lpPropertyInfo);
get_AbstractClass
Purpose:
This property returns the AbstractClass value. This value is VARIANT_TRUE if this is an abstract class and VARIANT_FALSE if it is not. (Note that for Visual Basic, VARIANT_TRUE and VARIANT_FALSE are just True and False.)
Syntax:
HRESULT get_AbstractClass(
[out, retval] VARIANT_BOOL *pVal);
put_AbstractClass
Purpose:
This property sets the AbstractClass value. The default value is VARIANT_FALSE, that is, this is not an abstract class. Set this property to VARIANT_TRUE before this class is created in the model, if you want this class to be an abstract class. (Note that for Visual Basic, VARIANT_TRUE and VARIANT_FALSE are just True and False.)
Syntax:
HRESULT put_AbstractClass(
[in] VARIANT_BOOL newVal);
get_ObjectDescReq
Purpose:
This property allows the meta model designer to force all objects in a class to have a Description rather than a NULL value.
Gets the ObjectDescReq value for the class. When set to True, the engine will check as any object is added to the class (or updated in the class) that the Description property for the object is not NULL. If it is, an error will be returned and the object add (or update) will fail.
An error will be returned if this property is used on class objects in MDS-owned meta models.
Syntax:
HRESULT get_ObjectDescReq(
[out, retval] VARIANT_BOOL *pVal);
put_ObjectDescReq
Purpose:
This property allows the meta model designer to force all objects in a class to have a Description rather than a NULL value.
Sets the ObjectDescReq value for the class. When set to True, the engine will check as any object is added to the class (or updated in the class) that the Description property for the object is not NULL. If it is, an error will be returned and the object add (or update) will fail.
Syntax:
HRESULT put_ObjectDescReq(
[in] VARIANT_BOOL newVal);
get_SuperClassList
Purpose:
This property returns a IMetaInfoKeyList collection object, which contains the object IDs and names of the super-classes of this class.
Syntax:
HRESULT get_SuperClassList(
[out, retval] IMetaInfoKeyList* *pVal);
put_SuperClassList
Purpose:
This property sets the list of super-classes for this object through the IMetaInfoKeyList parameter. By default this list is empty, that is, there are no super classes for this class. If you wish to inherit properties and relationships from other classes, add IMetaInfoKey objects to this collection where the IMetaInfoKey objects have the class ID of the class you wish to inherit from. (Any names you specify for the IMetaInfoKey objects will be ignored.)
Syntax:
HRESULT put_SuperClassList(
[in] IMetaInfoKeyList* newVal);
get_SubClassList
Purpose:
This read-only property is used to return the list of sub classes for this class, that is, the list of classes for which this class is a super class. The IMetaInfoKey items contained in the IMetaInfoKeyList collection are the names and class IDs (loids) of the sub classes. It is not necessary to do a Read before calling this routine, but in that case the ObjectID must be set.
Syntax:
HRESULT get_SubClassList(
[out, retval] IMetaInfoKeyList* *pVal);
Delete
Purpose:
Use this method to delete the class description object from the MDS repository.
Requirements:
The object identifier must be set before calling the Delete method.
Syntax:
HRESULT Delete();
Read
Purpose:
Use this method to read the class description object from the MDS repository.
Description
The Detail argument indicates whether to read the list of the relationships and property descriptions for this particular class. If the Detail is true, read the class description and its relationships and property descriptions. If the Detail is false (0), read the class description object only.
Requirements:
The object identifier must be set before calling the Read method.
Syntax:
HRESULT Read(
[in, optional] VARIANT_BOOL Detail);
Update
Purpose:
Use this method to modify certain attributes of the MetaPropertyInfo object after it has been created. See the Microsoft Visual C++ Programmer’s Guide for attributes that can be changed.
Syntax
HRESULT Update();
GetVersionSupport
Purpose:
Returns the current setting for the VersioningSupport property of a MetaClassInfo object. For an existing Class, this value is only meaningful after calling Read.
Description:
The VersioningSupport property has three possible values:
Syntax:
HRESULT GetVersionSupport(
[out, retval] MetaVersionSupportLevel* level);
SetVersioning
Purpose:
Allows an application to dynamically enable or disable data versioning for a class.
Description:
Derived classes may not be used with this API. If bVersioningAllowed is false, data versioning will be disabled for the class. If bVersioningAllowed is true and repository versioning is enabled, then data versioning will be enabled for the class, else versioning will be left disabled for the class. bDeleteVersions indicates if existing historical versions for objects in the class should be deleted or retained, however, this parameter is ignored unless version is already off for this class or is being turned off by this call.
Disabling versioning can affect the existing objects in the class. If bDeleteVersions is true, all objects in the class will be modified so that all non-published versions are deleted and the remaining versions will be renumbered to version one. This can be a very lengthy operation. If bDeleteVersions is false, all existing versions of data objects in the class will be retained. Any new objects added to the class will be created without support of versioning.
Changing the data versioning support for a class will also change the versioning support for any derived classes that have the class as their base class. A derived class's data versioning support is always the same as that of the base class.
A Read call does not need to be done before this call, but in that case, either the class ID or class GUID must be set.
Syntax:
HRESULT SetVersioning(
[in] VARIANT_BOOL bVersioningAllowed,
[in, optional] VARIANT_BOOL bDeleteVersions);