com.bmc.cmdb.api
Class CMDBClass

java.lang.Object
  extended by com.bmc.cmdb.api.CMDBClass
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
CMDBRelationship

public class CMDBClass
extends java.lang.Object
implements java.io.Serializable

The CMDBClass class allows you to define a class in the BMC Atrium CMDB. CMDBClassNameKey, which is passed as a parameter for constructing this class, uniquely identifies the class. You can also specify the attributes of the class using an attribute map object.

See Also:
Serialized Form

Field Summary
static int CMDB_CLASS_ABSTRACT_TYPE_DATA_REPLC
          Specifies that the class created is an abstract class with data replication.
static int CMDB_CLASS_ABSTRACT_TYPE_NONE
          The CMDB_CLASS_ABSTRACT_
static int CMDB_CLASS_ABSTRACT_TYPE_REGULAR
          Specifies that the class created is a regular abstract type.
static int CMDB_CLASS_CHARAC_ABSTRACT
          Specifies that the class created is an abstract class, which means that no instances can be created for the class and that all attributes are propagated to the subclasses.
static int CMDB_CLASS_CHARAC_AUTHOR
          Specifies the author of the class.
static int CMDB_CLASS_CHARAC_CATEGORIZATION_SUBCLASS
          Specifies that the class created is a categorization class.
static int CMDB_CLASS_CHARAC_CLASS_HIDDEN_PERMS
          Specifies hidden permissions for the class.
static int CMDB_CLASS_CHARAC_CLASS_VISIBLE_PERMS
          Specifies the visible permissions for the class.
static int CMDB_CLASS_CHARAC_DESCRIPTION
          Specifies the description for the class.
static int CMDB_CLASS_CHARAC_FINAL
          Specifies that the class created is a final class, which means that you cannot create subclasses from this class.
static int CMDB_CLASS_CHARAC_FORM_NAME
          Specifies the form name for the class.
static int CMDB_CLASS_CHARAC_NONE
          The CMDB_CLASS_CHARAC_
static int CMDB_CLASS_CHARAC_SINGLETON
          Specifies that the class created is a singelton class.
static int CMDB_DELETE_CLASS_OPTION_ALL_DEPENDENCIES
          Specifies that the class, its instances, and its relationships are deleted in this option.
static int CMDB_DELETE_CLASS_OPTION_NONE
          The CMDB_DELETE_CLASS_
static int CMDB_DELETE_CLASS_OPTION_WITH_DATA
          Specifies that the class and its instances are deleted.
 
Constructor Summary
CMDBClass(CMDBClassNameKey classKey, CMDBClassNameKey aSuperClassKey)
          This constructor creates a class with the class name and namespace specified in the ClassKey parameter.
CMDBClass(CMDBClassNameKey aNameKey, CMDBClassNameKey aSuperClassKey, java.util.Map anAttributeMap, CMDBIndex[] indexArray)
          This constructor creates the class with the specified name and attributes.
CMDBClass(CMDBClassNameKey classKey, java.lang.String classId, CMDBClassNameKey aSuperClassKey)
          This constructor creates a class using the specified class ID.
 
Method Summary
 void addCustomCharacteristic(int charactId, Value charactVal)
          This method adds the specified custom characteristic to the class.
 void create(ARServerUser context)
          Creates the class in BMC Atrium CMDB.
static void delete(ARServerUser context, CMDBClassNameKey classKey, int deleteOption)
          Deletes the class from BMC Atrium CMDB.
static CMDBClassNameKey[] find(ARServerUser context, java.lang.String aNamespace, CMDBClassNameKey relatedClassKey, CMDBClassNameKey superClass, PropInfo[] characQuery, boolean getHiddenClasses)
          Find names of all classes that satisfy the specified query criteria.
static CMDBClass findByKey(ARServerUser context, CMDBClassNameKey searchKey, boolean getHiddenAttribute, boolean getDerivedAttrs)
          Finds the class that has attributes containing the specified hidden and derived properties.
static CMDBClass findByKey(ARServerUser context, CMDBClassNameKey searchKey, boolean getHiddenAttribute, boolean getDerivedAttrs, PropInfo[] attrCharacQuery)
          Finds the class that has attributes containing the specified hidden and derived properties and attribute characteristics.
 int getAbstract()
          Gets the abstract characteristic of the class.
 CMDBAttribute getAttributeByName(java.lang.String attributeName)
          Gets the specified attribute for the class.
 java.util.Map getAttributes()
          Gets all the attributes of the class.
 CMDBAuditInfo getAuditInfo()
          Gets the audit option that is set for the class.
 java.lang.String getAuthor()
          Gets the author of the class.
 boolean getCategorizationSubclass()
          Gets a Boolean value that indicates whether the class is a Categorization type.
 java.lang.String getClassFormName()
          Gets the form name of the class.
 java.lang.String getClassHiddenPerms()
          Gets the hidden permissions of the class.
 java.lang.String getClassVisiblePerms()
          Gets the visible permissions of the class.
 Value getCustomCharacteristic(int charactId)
          Gets the specified custom characteristic of the class.
 java.util.Map getCustomCharacteristicMap()
          Gets all of the custom characteristics as a map.
 java.lang.String getDescription()
          Gets the description of the class.
 boolean getFinal()
          Gets a Boolean value that indicates whether the class is a Final type.
 java.lang.String getId()
          Gets the ID of the class.
 CMDBIndex[] getIndexes()
          Gets the list of indexes for the class.
 java.lang.String[] getKeyAttributeNames()
          Gets a list of the key attributes that identify each class.
 java.util.Map getKeyAttributes()
          Gets all the key attributes that identify each class.
 CMDBClassNameKey getNameKey()
          Gets the name key of the class.
 boolean getSingleton()
          Returns a Boolean value that indicates whether the class is a Singleton type.
 CMDBClassNameKey getSuperclassKey()
          Gets the key of the superclass to which the class is associated.
 void removeAllCustomCharacteristic()
          Removes all custom characteristics from the class.
 void removeCustomCharacteristic(int charactId)
          Removes the specified custom characteristic from the class.
 void setAbstract(int abstractType)
          Sets the value that defines the Abstract type of the class.
 void setAttributes(java.util.Map newAttributeMap)
          Sets all the attributes of the class.
 void setAuditInfo(CMDBAuditInfo aAuditInfo)
          Sets the audit option for the class.
 void setAuthor(java.lang.String authorName)
          Sets the author of the class.
 void setCategorizationSubclass(boolean isCateSubclass)
          Sets a Boolean value that determines that the class is of type Categorization.
 void setClassHiddenPerms(java.lang.String classHiddenPerm)
          Sets the hidden permissions of the class.
 void setClassVisiblePerms(java.lang.String classVisiblePerm)
          Sets visible permissions of the class.
 void setDescription(java.lang.String description)
          Sets the description of the class.
 void setFinal(boolean isFinal)
          Sets a Boolean value for the Final characteristic of the class.
 void setIndexes(CMDBIndex[] indexArray)
          Sets the list of indexes of the class.
 void setNameKey(CMDBClassNameKey aNameKey)
          Sets the name key of the class.
 void setNewNameKey(CMDBClassNameKey aNewNameKey)
          Sets the name key of the class.
 void setSingleton(boolean isSingleton)
          Sets a Boolean value for the Singleton characteristic of the class.
 void update(ARServerUser context)
          Sets the changes made to the class in BMC Atrium CMDB.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CMDB_DELETE_CLASS_OPTION_NONE

public static final int CMDB_DELETE_CLASS_OPTION_NONE
The CMDB_DELETE_CLASS_

CMDB_DELETE_CLASS_OPTION_WITH_DATA

public static final int CMDB_DELETE_CLASS_OPTION_WITH_DATA
Specifies that the class and its instances are deleted.

See Also:
Constant Field Values

CMDB_DELETE_CLASS_OPTION_ALL_DEPENDENCIES

public static final int CMDB_DELETE_CLASS_OPTION_ALL_DEPENDENCIES
Specifies that the class, its instances, and its relationships are deleted in this option.

See Also:
Constant Field Values

CMDB_CLASS_ABSTRACT_TYPE_NONE

public static final int CMDB_CLASS_ABSTRACT_TYPE_NONE
The CMDB_CLASS_ABSTRACT_

CMDB_CLASS_ABSTRACT_TYPE_REGULAR

public static final int CMDB_CLASS_ABSTRACT_TYPE_REGULAR
Specifies that the class created is a regular abstract type.

See Also:
Constant Field Values

CMDB_CLASS_ABSTRACT_TYPE_DATA_REPLC

public static final int CMDB_CLASS_ABSTRACT_TYPE_DATA_REPLC
Specifies that the class created is an abstract class with data replication.

See Also:
Constant Field Values

CMDB_CLASS_CHARAC_NONE

public static final int CMDB_CLASS_CHARAC_NONE
The CMDB_CLASS_CHARAC_

CMDB_CLASS_CHARAC_SINGLETON

public static final int CMDB_CLASS_CHARAC_SINGLETON
Specifies that the class created is a singelton class.

See Also:
Constant Field Values

CMDB_CLASS_CHARAC_ABSTRACT

public static final int CMDB_CLASS_CHARAC_ABSTRACT
Specifies that the class created is an abstract class, which means that no instances can be created for the class and that all attributes are propagated to the subclasses.

See Also:
Constant Field Values

CMDB_CLASS_CHARAC_FINAL

public static final int CMDB_CLASS_CHARAC_FINAL
Specifies that the class created is a final class, which means that you cannot create subclasses from this class.

See Also:
Constant Field Values

CMDB_CLASS_CHARAC_AUTHOR

public static final int CMDB_CLASS_CHARAC_AUTHOR
Specifies the author of the class.

See Also:
Constant Field Values

CMDB_CLASS_CHARAC_DESCRIPTION

public static final int CMDB_CLASS_CHARAC_DESCRIPTION
Specifies the description for the class.

See Also:
Constant Field Values

CMDB_CLASS_CHARAC_CLASS_HIDDEN_PERMS

public static final int CMDB_CLASS_CHARAC_CLASS_HIDDEN_PERMS
Specifies hidden permissions for the class. If the class is marked as Hidden, it is not visible to a group or a role.

See Also:
Constant Field Values

CMDB_CLASS_CHARAC_CLASS_VISIBLE_PERMS

public static final int CMDB_CLASS_CHARAC_CLASS_VISIBLE_PERMS
Specifies the visible permissions for the class. If the class is marked as Visible, it is visible to a group or a role.

See Also:
Constant Field Values

CMDB_CLASS_CHARAC_CATEGORIZATION_SUBCLASS

public static final int CMDB_CLASS_CHARAC_CATEGORIZATION_SUBCLASS
Specifies that the class created is a categorization class.

See Also:
Constant Field Values

CMDB_CLASS_CHARAC_FORM_NAME

public static final int CMDB_CLASS_CHARAC_FORM_NAME
Specifies the form name for the class. This is a read-only characteristic.

See Also:
Constant Field Values
Constructor Detail

CMDBClass

public CMDBClass(CMDBClassNameKey classKey,
                 CMDBClassNameKey aSuperClassKey)
This constructor creates a class with the class name and namespace specified in the ClassKey parameter.

Parameters:
classKey - holds the class name and namespace.
aSuperClassKey - holds the class name and namespace of the super class to which the class is associated

CMDBClass

public CMDBClass(CMDBClassNameKey classKey,
                 java.lang.String classId,
                 CMDBClassNameKey aSuperClassKey)
This constructor creates a class using the specified class ID.

Parameters:
classKey - holds the class name and namespace.
aSuperClassKey - holds the class name and namespace of the super class to which the class is associated.
classId - holds the name of the class.

CMDBClass

public CMDBClass(CMDBClassNameKey aNameKey,
                 CMDBClassNameKey aSuperClassKey,
                 java.util.Map anAttributeMap,
                 CMDBIndex[] indexArray)
This constructor creates the class with the specified name and attributes. Once the class is created, it generates a globally unique identifier (GUID) as the class ID.

Parameters:
anameKey - holds the class name and namespace.
aSuperClassKey - holds the class name and namespace of the super class to which the class is associated.
anAttributeMap - holds the attributes of the class. The attributes are organized as a map that uses the attribute name as its map key and CMDBAttribute as its mapped value.
indexArray - holds an array of indexes for the class.
Method Detail

addCustomCharacteristic

public void addCustomCharacteristic(int charactId,
                                    Value charactVal)
This method adds the specified custom characteristic to the class. The charactID parameter is a constant defined in BMC Atrium CMDB.

Parameters:
charactId - holds the ID of the characteristic.
charactVal - holds the value of the characteristic.

getId

public java.lang.String getId()
Gets the ID of the class.

Returns:
returns the ID of the class

getNameKey

public CMDBClassNameKey getNameKey()
Gets the name key of the class.

Returns:
returns the name key of the class

getAuditInfo

public CMDBAuditInfo getAuditInfo()
Gets the audit option that is set for the class.

Returns:
the audit option set for the class

getAttributeByName

public CMDBAttribute getAttributeByName(java.lang.String attributeName)
Gets the specified attribute for the class.

Parameters:
attributeName - the name of the attribute to be retrieved
Returns:
returns the specified attribute name

getAttributes

public java.util.Map getAttributes()
Gets all the attributes of the class. The attributes are organized in the format of a map that uses the attribute name as its key and CMDBAttribute as its mapped value.

Returns:
returns all of the attributes of the class

getKeyAttributes

public java.util.Map getKeyAttributes()
Gets all the key attributes that identify each class. The key attributes are stored in a class index with flag "primaryKey" set to true. If no primary key index is defined in the class, then null will be returned for this method. If multiple index keys are defined, then the first primary key located in the index is always returned.

Returns:
If no primary key index is defined in the class, then null will be returned for this method. If multiple index keys are defined, then the first primary key located in the index is always returned.

getKeyAttributeNames

public java.lang.String[] getKeyAttributeNames()
Gets a list of the key attributes that identify each class. The key attributes are stored in a class index with flag "primaryKey" set to true. If no primary key index is defined in the class, then null will be returned for this method. If multiple index keys are defined, then the first primary key located in the index is always returned.

Returns:
If no primary key index is defined in the class, then null will be returned for this method. If multiple index keys are defined, then the first primary key located in the index is always returned.

getIndexes

public CMDBIndex[] getIndexes()
Gets the list of indexes for the class.

Returns:
returns the list of indexes for the class

getSuperclassKey

public CMDBClassNameKey getSuperclassKey()
Gets the key of the superclass to which the class is associated.

Returns:
returns the key of the superclass to which the class is associated

getSingleton

public boolean getSingleton()
Returns a Boolean value that indicates whether the class is a Singleton type. If this characteristic is not set, the returned value defaults to false.

Returns:
Returns a Boolean value that indicates whether the class is a Singleton type. If this characteristic is not set, the returned value defaults to false.

getAbstract

public int getAbstract()
Gets the abstract characteristic of the class.

Returns:
returns the abstract characteristic of the class

getFinal

public boolean getFinal()
Gets a Boolean value that indicates whether the class is a Final type. If this characteristic is not set, the returned value defaults to false.

Returns:
Returns a Boolean value that indicates whether the class is a Final type. If this characteristic is not set, the returned value defaults to false.

getAuthor

public java.lang.String getAuthor()
Gets the author of the class.

Returns:
returns the author of the class

getDescription

public java.lang.String getDescription()
Gets the description of the class.

Returns:
returns the description of the class

getClassHiddenPerms

public java.lang.String getClassHiddenPerms()
Gets the hidden permissions of the class.

Returns:
returns the hidden permissions of the class

getClassVisiblePerms

public java.lang.String getClassVisiblePerms()
Gets the visible permissions of the class.

Returns:
returns the visible permissions of the class

getCategorizationSubclass

public boolean getCategorizationSubclass()
Gets a Boolean value that indicates whether the class is a Categorization type. If this characteristic is not set, the returned value defaults to false.

Returns:
Returns a Boolean value that indicates whether the class is a Categorization type. If this characteristic is not set, the returned value defaults to false.

getClassFormName

public java.lang.String getClassFormName()
Gets the form name of the class.

Returns:
returns the form name of the class

getCustomCharacteristic

public Value getCustomCharacteristic(int charactId)
Gets the specified custom characteristic of the class.

Parameters:
charactId - holds the ID of the characteristic
Returns:
returns the specified custom characteristic of the class

getCustomCharacteristicMap

public java.util.Map getCustomCharacteristicMap()
Gets all of the custom characteristics as a map. The map is a collection of values with property ID as its map key.

Returns:
returns all of the custom characteristics as a map

removeCustomCharacteristic

public void removeCustomCharacteristic(int charactId)
Removes the specified custom characteristic from the class.

Parameters:
charactId - holds the ID of the characteristic that is to be removed.

removeAllCustomCharacteristic

public void removeAllCustomCharacteristic()
Removes all custom characteristics from the class.


setNameKey

public void setNameKey(CMDBClassNameKey aNameKey)
Sets the name key of the class.

Parameters:
aNameKey - holds the name key of the class

setAuditInfo

public void setAuditInfo(CMDBAuditInfo aAuditInfo)
Sets the audit option for the class.

Parameters:
aAuditInfo - holds the audit option for the class, such as Audit and Copy, or Log

setNewNameKey

public void setNewNameKey(CMDBClassNameKey aNewNameKey)
Sets the name key of the class. This call should be used with the update(com.bmc.arsys.api.ARServerUser) method to modify the class name in BMC Atrium CMDB.

Parameters:
aNewNameKey - holds the new name key of the class

setIndexes

public void setIndexes(CMDBIndex[] indexArray)
Sets the list of indexes of the class. The key attributes are stored in a class index with flag "primaryKey" set to true.

Parameters:
indexArray - holds an array of indexes for the class

setAttributes

public void setAttributes(java.util.Map newAttributeMap)
Sets all the attributes of the class. The attributes are organized into a map that uses attribute name as its map key and CMDBAttribute as its mapped value.

Parameters:
newAttributeMap - the new attribute map to be set

setSingleton

public void setSingleton(boolean isSingleton)
Sets a Boolean value for the Singleton characteristic of the class.

Parameters:
isSingleton - holds a Boolean value for the Singleton characteristic.

setAbstract

public void setAbstract(int abstractType)
Sets the value that defines the Abstract type of the class.

Parameters:
abstractType - holds the Abstract type of the class

setFinal

public void setFinal(boolean isFinal)
Sets a Boolean value for the Final characteristic of the class.

Parameters:
isFinal - holds a Boolean value for the Final characteristic

setAuthor

public void setAuthor(java.lang.String authorName)
Sets the author of the class.

Parameters:
authorName - holds the name of the author

setDescription

public void setDescription(java.lang.String description)
Sets the description of the class.

Parameters:
description - holds the description of the class

setClassHiddenPerms

public void setClassHiddenPerms(java.lang.String classHiddenPerm)
Sets the hidden permissions of the class.

Parameters:
classHiddenPerm - holds the hidden permissions of the class

setClassVisiblePerms

public void setClassVisiblePerms(java.lang.String classVisiblePerm)
Sets visible permissions of the class.

Parameters:
classVisivlePerm - holds the visible permissions of the class

setCategorizationSubclass

public void setCategorizationSubclass(boolean isCateSubclass)
Sets a Boolean value that determines that the class is of type Categorization.

Parameters:
isCateSubClass - holds a Boolean value that determines whether the class is a Categorization type

create

public void create(ARServerUser context)
            throws ARException
Creates the class in BMC Atrium CMDB.

Parameters:
context - holds the AR System user and host information.
Throws:
java.lang.NullPointerException - if If a null parameter is passed
ARException - returns exception-handling responsibility to the method making the call

update

public void update(ARServerUser context)
            throws ARException
Sets the changes made to the class in BMC Atrium CMDB.

Parameters:
context - holds the AR System user and host information.
Throws:
java.lang.NullPointerException - if If a null parameter is passed
ARException - returns exception-handling responsibility to the method making the call

delete

public static void delete(ARServerUser context,
                          CMDBClassNameKey classKey,
                          int deleteOption)
                   throws ARException
Deletes the class from BMC Atrium CMDB.

Parameters:
context - holds the AR System user and host information.
classKey - the holds name key of the class that is to be deleted.
deleteOption - holds the delete option for the class.
Throws:
java.lang.NullPointerException - if If a null parameter is passed
ARException - returns exception-handling responsibility to the method making the call

findByKey

public static CMDBClass findByKey(ARServerUser context,
                                  CMDBClassNameKey searchKey,
                                  boolean getHiddenAttribute,
                                  boolean getDerivedAttrs)
                           throws ARException
Finds the class that has attributes containing the specified hidden and derived properties. The getHiddenAttribute and getDerivedAttrs parameters are constants defined in BMC Atrium CMDB.

Parameters:
context - holds the AR System user and host information.
searchKey - holds the class name key of the class.
getHiddenAttribute - specifies if a hidden attribute needs to be retrieved.
getDerivedAttrs - indicates if derived attributes will be retrieved.
Returns:
returns the class that has attributes containing the specified hidden and derived properties
Throws:
ARException - if a null parameter is passed

findByKey

public static CMDBClass findByKey(ARServerUser context,
                                  CMDBClassNameKey searchKey,
                                  boolean getHiddenAttribute,
                                  boolean getDerivedAttrs,
                                  PropInfo[] attrCharacQuery)
                           throws ARException
Finds the class that has attributes containing the specified hidden and derived properties and attribute characteristics. The getHiddenAttribute and getDerivedAttrs parameters are constants defined in BMC Atrium CMDB.

Parameters:
context - holds the AR System user and host information.
searchKey - holds the class name key of the class.
getHiddenAttribute - specifies if a hidden attribute needs to be retrieved.
getDerivedAttrs - indicates if derived attributes will be retrieved.
attrCharacQuery - specifies criteria for the matching attributes.
Returns:
returns the class that has attributes containing the specified hidden and derived properties and attribute characteristics.
Throws:
java.lang.NullPointerException - if If a null parameter is passed
ARException - returns exception-handling responsibility to the method making the call

find

public static CMDBClassNameKey[] find(ARServerUser context,
                                      java.lang.String aNamespace,
                                      CMDBClassNameKey relatedClassKey,
                                      CMDBClassNameKey superClass,
                                      PropInfo[] characQuery,
                                      boolean getHiddenClasses)
                               throws ARException
Find names of all classes that satisfy the specified query criteria. The getHiddenClasses parameter is a constant defined in BMC Atrium CMDB.

Parameters:
context - holds the AR System user and host information.
aNamespace - holds the namespace to which the classes belong.
relatedClassKey - hold the name keys of classes that relate to this class.
superClass - hold the class key information for the superclass.
characQuery - specifies the criteria for the matching characteristics.
getHiddenClasses - flag specifies whether the hidden classes is returned.
Returns:
returns the names of all classes that satisfy the specified query criteria
Throws:
java.lang.NullPointerException - if If a null parameter is passed
ARException - returns exception-handling responsibility to the method making the call


(c) Copyright 2004-2007 BMC Software, Inc.