com.remedy.cmdb.api
Class CMDBClass

java.lang.Object
  extended bycom.remedy.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 describes an CMDBClass object.

See Also:
Serialized Form

Field Summary
static int CMDB_CLASS_ABSTRACT_TYPE_DATA_REPLC
          Data replication abstract class.
static int CMDB_CLASS_ABSTRACT_TYPE_NONE
          Not an abstract class.
static int CMDB_CLASS_ABSTRACT_TYPE_REGULAR
          Regular abstract class.
static int CMDB_CLASS_CHARAC_ABSTRACT
          The characteristic is Abstract for the CMDBClass.
static int CMDB_CLASS_CHARAC_AUTHOR
          The characteristic is Author for the CMDBClass.
static int CMDB_CLASS_CHARAC_CATEGORIZATION_SUBCLASS
          The characteristic is Subclass for the CMDBClass.
static int CMDB_CLASS_CHARAC_CLASS_HIDDEN_PERMS
          The characteristic is Hidden Permissions for the CMDBClass object.
static int CMDB_CLASS_CHARAC_CLASS_VISIBLE_PERMS
          The characteristic is Visible Permissions for the CMDBClass object.
static int CMDB_CLASS_CHARAC_DESCRIPTION
          The characteristic is Description for the CMDBClass.
static int CMDB_CLASS_CHARAC_FINAL
          The characteristic is Final for the CMDBClass.
static int CMDB_CLASS_CHARAC_FORM_NAME
          The characteristic is form name of the CMDBClass.
static int CMDB_CLASS_CHARAC_NONE
          No characteristic for the CMDBClass.
static int CMDB_CLASS_CHARAC_SINGLETON
          The characteristic is Singleton for the CMDBClass.
static int CMDB_DELETE_CLASS_OPTION_ALL_DEPENDENCIES
          Delete class, all its derived classes and all its dependent relationship classes.
static int CMDB_DELETE_CLASS_OPTION_NONE
          Delete the class only if the class contains no instances and has no derived classes or dependent relationships.
static int CMDB_DELETE_CLASS_OPTION_WITH_DATA
          Delete the class only if the class has no derived classes or dependent relationships
 
Constructor Summary
CMDBClass(CMDBClassNameKey classKey, CMDBClassNameKey aSuperClassKey)
          Creates an CMDBClass object with minimum information.
CMDBClass(CMDBClassNameKey aNameKey, CMDBClassNameKey aSuperClassKey, java.util.Map anAttributeMap, CMDBIndex[] indexArray)
          Constructor that sets CMDBClass with the information provided and generates a unique GUID as the class ID of the CMDBClass object.
CMDBClass(CMDBClassNameKey classKey, java.lang.String classId, CMDBClassNameKey aSuperClassKey)
          Create an CMDBClass object with minimum information.
 
Method Summary
 void addCustomCharacteristic(int charactId, Value charactVal)
          Adds the specified custom characteristic to the class.
 void create(ARServerUser context)
          Creates the current CMDBClass object in AR System.
static void delete(ARServerUser context, CMDBClassNameKey classKey, int deleteOption)
          Deletes the current CMDBClass object from AR System.
static CMDBClassNameKey[] find(ARServerUser context, java.lang.String aNamespace, CMDBClassNameKey relatedClassKey, CMDBClassNameKey superClass, PropInfo[] characQuery, boolean getHiddenClasses)
          Find names of all CMDBClass objects that satisfy the specified query criteria.
static CMDBClass findByKey(ARServerUser context, CMDBClassNameKey searchKey, boolean getHiddenAttribute, boolean getDerivedAttrs)
          Finds the specified CMDBClass object in AR System.
static CMDBClass findByKey(ARServerUser context, CMDBClassNameKey searchKey, boolean getHiddenAttribute, boolean getDerivedAttrs, PropInfo[] attrCharacQuery)
          Finds the specified CMDBClass object in AR System.
 int getAbstract()
          Returns the Abstract characteristic.
 CMDBAttribute getAttributeByName(java.lang.String attributeName)
          Finds the attribute in the class using the provided attribute name as a search key.
 java.util.Map getAttributes()
          Gets all the attributes of the CMDBClass object.
 CMDBAuditInfo getAuditInfo()
          Gets the audit info of the CMDBClass object.
 java.lang.String getAuthor()
          Returns the Author characteristic.
 boolean getCategorizationSubclass()
          Returns the Categorization Subclass characteristic.
 java.lang.String getClassFormName()
          Returns the Class form name characteristic.
 java.lang.String getClassHiddenPerms()
          Returns the Class Hidden Permission characteristic.
 java.lang.String getClassVisiblePerms()
          Returns the Class Visible Permission characteristic.
 Value getCustomCharacteristic(int charactId)
          Gets the specified custom characteristic.
 java.util.Map getCustomCharacteristicMap()
          Retrieves all custom characteristics as a map.
 java.lang.String getDescription()
          Returns the Description characteristic.
 boolean getFinal()
          Returns the Final characteristic.
 java.lang.String getId()
          Gets the ID of the CMDBClass object.
 CMDBIndex[] getIndexes()
          Gets the index of the CMDBClass object.
 java.lang.String[] getKeyAttributeNames()
          Gets the names of key attributes that identify each CMDBClass object.
 java.util.Map getKeyAttributes()
          Gets all the key attributes that identify each CMDBClass object.
 CMDBClassNameKey getNameKey()
          Gets the name key of the CMDBClass object.
 boolean getSingleton()
          Returns the Singleton characteristic.
 CMDBClassNameKey getSuperclassKey()
          Gets the key of the super class.
 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 Abstract characteristic.
 void setAttributes(java.util.Map newAttributeMap)
          Sets/replaces all the attributes of the CMDBclass.
 void setAuditInfo(CMDBAuditInfo aAuditInfo)
          Sets the audit info of an CMDBClass object.
 void setAuthor(java.lang.String authorName)
          Sets the Author characteristic.
 void setCategorizationSubclass(boolean isCateSubclass)
          Sets the Categorization Subclass characteristic.
 void setClassHiddenPerms(java.lang.String classHiddenPerm)
          Sets the Class Hidden Permission characteristic.
 void setClassVisiblePerms(java.lang.String classVisiblePerm)
          Sets the Class Visible Permission characteristic.
 void setDescription(java.lang.String description)
          Sets the Description characteristic.
 void setFinal(boolean isFinal)
          Sets the Final characteristic.
 void setIndexes(CMDBIndex[] indexArray)
          Sets the index of the CMDBClass object.
 void setNameKey(CMDBClassNameKey aNameKey)
          Sets the name key of an CMDBClass object.
 void setNewNameKey(CMDBClassNameKey aNewNameKey)
          Changes the name key of an CMDBClass object.
 void setSingleton(boolean isSingleton)
          Sets the Singleton characteristic.
 void update(ARServerUser context)
          Saves the change made to the current CMDBClass object in AR System.
 
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
Delete the class only if the class contains no instances and has no derived classes or dependent relationships.

See Also:
Constant Field Values

CMDB_DELETE_CLASS_OPTION_WITH_DATA

public static final int CMDB_DELETE_CLASS_OPTION_WITH_DATA
Delete the class only if the class has no derived classes or dependent relationships

See Also:
Constant Field Values

CMDB_DELETE_CLASS_OPTION_ALL_DEPENDENCIES

public static final int CMDB_DELETE_CLASS_OPTION_ALL_DEPENDENCIES
Delete class, all its derived classes and all its dependent relationship classes.

See Also:
Constant Field Values

CMDB_CLASS_ABSTRACT_TYPE_NONE

public static final int CMDB_CLASS_ABSTRACT_TYPE_NONE
Not an abstract class.

See Also:
Constant Field Values

CMDB_CLASS_ABSTRACT_TYPE_REGULAR

public static final int CMDB_CLASS_ABSTRACT_TYPE_REGULAR
Regular abstract class.

See Also:
Constant Field Values

CMDB_CLASS_ABSTRACT_TYPE_DATA_REPLC

public static final int CMDB_CLASS_ABSTRACT_TYPE_DATA_REPLC
Data replication abstract class.

See Also:
Constant Field Values

CMDB_CLASS_CHARAC_NONE

public static final int CMDB_CLASS_CHARAC_NONE
No characteristic for the CMDBClass.

See Also:
Constant Field Values

CMDB_CLASS_CHARAC_SINGLETON

public static final int CMDB_CLASS_CHARAC_SINGLETON
The characteristic is Singleton for the CMDBClass.

See Also:
Constant Field Values

CMDB_CLASS_CHARAC_ABSTRACT

public static final int CMDB_CLASS_CHARAC_ABSTRACT
The characteristic is Abstract for the CMDBClass.

See Also:
Constant Field Values

CMDB_CLASS_CHARAC_FINAL

public static final int CMDB_CLASS_CHARAC_FINAL
The characteristic is Final for the CMDBClass.

See Also:
Constant Field Values

CMDB_CLASS_CHARAC_AUTHOR

public static final int CMDB_CLASS_CHARAC_AUTHOR
The characteristic is Author for the CMDBClass.

See Also:
Constant Field Values

CMDB_CLASS_CHARAC_DESCRIPTION

public static final int CMDB_CLASS_CHARAC_DESCRIPTION
The characteristic is Description for the CMDBClass.

See Also:
Constant Field Values

CMDB_CLASS_CHARAC_CLASS_HIDDEN_PERMS

public static final int CMDB_CLASS_CHARAC_CLASS_HIDDEN_PERMS
The characteristic is Hidden Permissions for the CMDBClass object.

See Also:
Constant Field Values

CMDB_CLASS_CHARAC_CLASS_VISIBLE_PERMS

public static final int CMDB_CLASS_CHARAC_CLASS_VISIBLE_PERMS
The characteristic is Visible Permissions for the CMDBClass object.

See Also:
Constant Field Values

CMDB_CLASS_CHARAC_CATEGORIZATION_SUBCLASS

public static final int CMDB_CLASS_CHARAC_CATEGORIZATION_SUBCLASS
The characteristic is Subclass for the CMDBClass.

See Also:
Constant Field Values

CMDB_CLASS_CHARAC_FORM_NAME

public static final int CMDB_CLASS_CHARAC_FORM_NAME
The characteristic is form name of the CMDBClass. This is a read-only characteristic.

See Also:
Constant Field Values
Constructor Detail

CMDBClass

public CMDBClass(CMDBClassNameKey classKey,
                 CMDBClassNameKey aSuperClassKey)
Creates an CMDBClass object with minimum information.

Parameters:
classKey - a class key
aSuperClassKey - the class key of the super class

CMDBClass

public CMDBClass(CMDBClassNameKey classKey,
                 java.lang.String classId,
                 CMDBClassNameKey aSuperClassKey)
Create an CMDBClass object with minimum information.

Parameters:
classKey - a class key
classId - the ID of the class
aSuperClassKey - the class key of the super class

CMDBClass

public CMDBClass(CMDBClassNameKey aNameKey,
                 CMDBClassNameKey aSuperClassKey,
                 java.util.Map anAttributeMap,
                 CMDBIndex[] indexArray)
Constructor that sets CMDBClass with the information provided and generates a unique GUID as the class ID of the CMDBClass object.

Parameters:
aNameKey - the name key of the CMDBClass object
aSuperClassKey - the key of the supper CMDBClass
anAttributeMap - 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 - an array of indexes
Throws:
java.lang.IllegalArgumentException - if the map value is not an expected one
Method Detail

addCustomCharacteristic

public void addCustomCharacteristic(int charactId,
                                    Value charactVal)
Adds the specified custom characteristic to the class.

Parameters:
charactId - the ID of the characteristic
charactVal - the value of the characteristic
Throws:
java.lang.IllegalArgumentException - if the characteristic is not in the expected range.

getId

public java.lang.String getId()
Gets the ID of the CMDBClass object. CMDBClass ID is a read-only property.

Returns:
the ID of the CMDBClass object

getNameKey

public CMDBClassNameKey getNameKey()
Gets the name key of the CMDBClass object.

Returns:
the name key of CMDBclass object

getAuditInfo

public CMDBAuditInfo getAuditInfo()
Gets the audit info of the CMDBClass object.

Returns:
the audit info of CMDBclass object

getAttributeByName

public CMDBAttribute getAttributeByName(java.lang.String attributeName)
Finds the attribute in the class using the provided attribute name as a search key.

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

getAttributes

public java.util.Map getAttributes()
Gets all the attributes of the CMDBClass object. 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:
attributes of the CMDBClass object

getKeyAttributes

public java.util.Map getKeyAttributes()
Gets all the key attributes that identify each CMDBClass object. The key attributes are stored in a class index with flag "primaryKey" being 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:
The key attributes retrieved. The attributes are collected into a map that uses the attribute name as its key and CMDBAttribute as its mapped value.

getKeyAttributeNames

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

Returns:
the names of key attributes

getIndexes

public CMDBIndex[] getIndexes()
Gets the index of the CMDBClass object.

Returns:
an array of class indexes

getSuperclassKey

public CMDBClassNameKey getSuperclassKey()
Gets the key of the super class.

Returns:
the key of the super class

getSingleton

public boolean getSingleton()
Returns the Singleton characteristic. If this characteristic is not set, the returned value defaults to false.

Returns:
Singleton characteristic

getAbstract

public int getAbstract()
Returns the Abstract characteristic.

Returns:
Abstract characteristic, which can be: CMDB_CLASS_ABSTRACT_TYPE_NONE, CMDB_CLASS_ABSTRACT_TYPE_REGULAR, or CMDB_CLASS_ABSTRACT_TYPE_DATA_REPLC.

getFinal

public boolean getFinal()
Returns the Final characteristic. If this characteristic is not set, the returned value defaults to false.

Returns:
Final characteristic

getAuthor

public java.lang.String getAuthor()
Returns the Author characteristic.

Returns:
Author characteristic

getDescription

public java.lang.String getDescription()
Returns the Description characteristic.

Returns:
Description characteristic

getClassHiddenPerms

public java.lang.String getClassHiddenPerms()
Returns the Class Hidden Permission characteristic.

Returns:
Class Hidden Permission characteristic

getClassVisiblePerms

public java.lang.String getClassVisiblePerms()
Returns the Class Visible Permission characteristic.

Returns:
Class Visible Permission characteristic

getCategorizationSubclass

public boolean getCategorizationSubclass()
Returns the Categorization Subclass characteristic. If this characteristic is not set, the returned value defaults to false.

Returns:
Categorization Subclass characteristic

getClassFormName

public java.lang.String getClassFormName()
Returns the Class form name characteristic.

Returns:
Class form name characteristic

getCustomCharacteristic

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

Parameters:
charactId - the ID of the characteristic requested
Returns:
the characteristic requested
Throws:
java.lang.IllegalArgumentException - if the characteristic is not in the expected range

getCustomCharacteristicMap

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

Returns:
all custom characteristics of the class
Throws:
java.lang.IllegalArgumentException - if the characteristic is not in the expected range

removeCustomCharacteristic

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

Parameters:
charactId - the ID of the characteristic to be removed
Throws:
java.lang.IllegalArgumentException - if the characteristic is not in the expected range

removeAllCustomCharacteristic

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


setNameKey

public void setNameKey(CMDBClassNameKey aNameKey)
Sets the name key of an CMDBClass object.

Parameters:
aNameKey - the name key of CMDBclass object

setAuditInfo

public void setAuditInfo(CMDBAuditInfo aAuditInfo)
Sets the audit info of an CMDBClass object.

Parameters:
aAuditInfo - the audit info of CMDBclass object

setNewNameKey

public void setNewNameKey(CMDBClassNameKey aNewNameKey)
Changes the name key of an CMDBClass object. This call should be used with the update(com.remedy.arsys.api.ARServerUser) method to modify the class name in AR System.

Parameters:
aNewNameKey - the new name key of the CMDBClass object

setIndexes

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

Parameters:
indexArray - an array of class indexes

setAttributes

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

Parameters:
newAttributeMap - the new attribute map to be set.
Throws:
java.lang.IllegalArgumentException - if map value is not CMDBAttribute

setSingleton

public void setSingleton(boolean isSingleton)
Sets the Singleton characteristic.

Parameters:
isSingleton - a boolean value for Singleton.

setAbstract

public void setAbstract(int abstractType)
Sets the Abstract characteristic.

Parameters:
abstractType - the type of Abstract, which can be CMDB_CLASS_ABSTRACT_TYPE_NONE CMDB_CLASS_ABSTRACT_TYPE_REGULAR CMDB_CLASS_ABSTRACT_TYPE_DATA_REPLC

setFinal

public void setFinal(boolean isFinal)
Sets the Final characteristic.

Parameters:
isFinal - a boolean value for Final.

setAuthor

public void setAuthor(java.lang.String authorName)
Sets the Author characteristic.

Parameters:
authorName - a String object for Author.

setDescription

public void setDescription(java.lang.String description)
Sets the Description characteristic.

Parameters:
description - a String object for Description.

setClassHiddenPerms

public void setClassHiddenPerms(java.lang.String classHiddenPerm)
Sets the Class Hidden Permission characteristic.

Parameters:
classHiddenPerm - a String object for ClassHiddenPermission

setClassVisiblePerms

public void setClassVisiblePerms(java.lang.String classVisiblePerm)
Sets the Class Visible Permission characteristic.

Parameters:
classVisiblePerm - a String object for ClassVisiblePermission

setCategorizationSubclass

public void setCategorizationSubclass(boolean isCateSubclass)
Sets the Categorization Subclass characteristic.

Parameters:
isCateSubclass - a boolean value for the Categorization Subclass

create

public void create(ARServerUser context)
            throws ARException
Creates the current CMDBClass object in AR System.

Parameters:
context - AR System user and host information
Throws:
ARException - if the class cannot be created in AR System

update

public void update(ARServerUser context)
            throws ARException
Saves the change made to the current CMDBClass object in AR System.

Parameters:
context - AR System user and host information
Throws:
ARException - if the class cannot be modified in AR System

delete

public static void delete(ARServerUser context,
                          CMDBClassNameKey classKey,
                          int deleteOption)
                   throws ARException
Deletes the current CMDBClass object from AR System.

Parameters:
context - AR System user and host information
classKey - the name key of the class to be deleted
deleteOption - delete option
Throws:
ARException - if the class cannot be deleted from AR System

findByKey

public static CMDBClass findByKey(ARServerUser context,
                                  CMDBClassNameKey searchKey,
                                  boolean getHiddenAttribute,
                                  boolean getDerivedAttrs)
                           throws ARException
Finds the specified CMDBClass object in AR System.

Parameters:
context - AR System user and host information
searchKey - the class name key of the CMDBClass
getHiddenAttribute - specifies if a hidden attribute needs to be retrieved
getDerivedAttrs - indicates if derived attributes will be retrieved
Returns:
the requested CMDBClass object
Throws:
ARException - if the requested class cannot be retrieved

findByKey

public static CMDBClass findByKey(ARServerUser context,
                                  CMDBClassNameKey searchKey,
                                  boolean getHiddenAttribute,
                                  boolean getDerivedAttrs,
                                  PropInfo[] attrCharacQuery)
                           throws ARException
Finds the specified CMDBClass object in AR System.

Parameters:
context - AR System user and host information
searchKey - the class name key of the CMDBClass
getHiddenAttribute - specifies if a hidden attribute needs to be retrieved
getDerivedAttrs - indicates if derived attributes will be retrieved
attrCharacQuery - Returns attributes that have these characteristics. If this argument is null, then the method will behave the same as the above findByKey, which returns all attributes that have the specified hidden and derive properties.
Returns:
the requested CMDBClass object
Throws:
ARException - if the requested class cannot be retrieved

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 CMDBClass objects that satisfy the specified query criteria.

Parameters:
context - AR System user and host information
aNamespace - classes belongs to this namespace
relatedClassKey - name keys of classes that relate to this class
superClass - classes that are inherited from this super class
characQuery - classes that have these characteristics
getHiddenClasses - flag indicates if hidden classes will be returned
Returns:
name keys of all the classes satisfied by the query
Throws:
ARException - if failed to return all matched class objects