com.bmc.cmdb.api
Class CMDBRelationship

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

public class CMDBRelationship
extends CMDBClass
implements java.io.Serializable

The CMDBRelationship class allows you to define a relationship class in BMC Atrium CMDB. CMDBClassNameKey, which is passed as a parameter for this class, holds the name of the relationship class and the namespace within which you want to define the class. You can define the relationship using an attribute map object to specify the attributes, and you can specify the relationship cardinality, role names, and relationship class names. After you define the relationship class, you can perform a query against it and update the attributes.

See Also:
Serialized Form

Field Summary
static int CMDB_CLASS_RELATIONSHIP_CARDINALITY_1_1
          Specifies that the cardinality is one-to-one, which means that this instance of the relationship class can exist between one instance of the source class and one instance of the destination class.
static int CMDB_CLASS_RELATIONSHIP_CARDINALITY_1_MANY
          Specifies that the cardinality is one-to-many, which means that this instance of the relationship class can exist between one instance of the source class and multiple instances of the destination class.
static int CMDB_CLASS_RELATIONSHIP_CARDINALITY_MANY_1
          Specifies that the cardinality is many-to-one, which means that this instance of the relationship class can exist between multiple instances of the source class and one instance of the destination class.
static int CMDB_CLASS_RELATIONSHIP_CARDINALITY_MANY_MANY
          Specifies that the cardinality is many-to-many, which means that this instance of the relationship class can exist between multiple instances of the source class and multiple instances of the destination class.
static int CMDB_CLASS_RELATIONSHIP_CARDINALITY_NONE
          Specifies that the cardinality is none.
 
Fields inherited from class com.bmc.cmdb.api.CMDBClass
CMDB_CLASS_ABSTRACT_TYPE_DATA_REPLC, CMDB_CLASS_ABSTRACT_TYPE_NONE, CMDB_CLASS_ABSTRACT_TYPE_REGULAR, CMDB_CLASS_CHARAC_ABSTRACT, CMDB_CLASS_CHARAC_AUTHOR, CMDB_CLASS_CHARAC_CATEGORIZATION_SUBCLASS, CMDB_CLASS_CHARAC_CLASS_HIDDEN_PERMS, CMDB_CLASS_CHARAC_CLASS_VISIBLE_PERMS, CMDB_CLASS_CHARAC_DESCRIPTION, CMDB_CLASS_CHARAC_FINAL, CMDB_CLASS_CHARAC_FORM_NAME, CMDB_CLASS_CHARAC_NONE, CMDB_CLASS_CHARAC_SINGLETON, CMDB_DELETE_CLASS_OPTION_ALL_DEPENDENCIES, CMDB_DELETE_CLASS_OPTION_NONE, CMDB_DELETE_CLASS_OPTION_WITH_DATA
 
Constructor Summary
CMDBRelationship(CMDBClassNameKey aNameKey, CMDBClassNameKey aSuperClassKey, java.util.Map newAttributeMap, CMDBIndex[] indexArray, java.lang.String[] newRoleNames, CMDBClassNameKey[] newRelClassNames, int aCardinality, boolean aWeakReference, CMDBWeakPropagatedAttrs[] aWeakAttrArray, boolean aCascadeDelete)
          Creates a relationship instance with the specified class name and namespace, attributes, relationship role names, relationship class names, relationship cardinality, propagated attribute information, and cascading delete option.
CMDBRelationship(CMDBClassNameKey relClassKey, CMDBClassNameKey aSuperClassKey, java.lang.String[] newRoleNames, CMDBClassNameKey[] newRelClassNames)
          Defines a relationship class with the class name and namespace information specified in the CMDBClassNameKey parameter, the relationship role names specified in the newRoleNames parameter, and the relationship class names specified in the newRelClassNames parameter.
CMDBRelationship(CMDBClassNameKey relClassKey, java.lang.String classId, CMDBClassNameKey aSuperClassKey, java.lang.String[] newRoleNames, CMDBClassNameKey[] newRelClassNames)
          Defines a relationship instance with the class name and namespace information specified in the CMDBClassNameKey parameter, the relationship role names specified in the newRoleNames parameter, and the relationship class names specified in the newRelClassNames parameter.
 
Method Summary
 int getCardinality()
          Gets the cardinality of the relationship.
 CMDBClassNameKey[] getRelationClassNames()
          Gets the list of class names to which the source member and destination member belong.
 java.lang.String[] getRoleNames()
          Gets a list of the names of the source and destination members of the relationship.
 CMDBWeakPropagatedAttrs[] getWeakPropagatedAttrs()
          Gets a list of the propagated attributes of the weak relationship.
 boolean isCascadeDelete()
          Tells if the relationship supports cascading deletion.
 boolean isRole2WeakReference()
          Tells if role two is a weak reference.
 void setCardinality(int cardinality)
          Sets the cardinality attribute of the CMDBRelationship object.
 void setCascadeDelete(boolean newCascadeDelete)
          Sets the cascading delete attribute of the CMDBRelationship object.
 void setRole2WeakReference(boolean newWeakReference)
          Sets the role 2 instance to be a weak reference.
 void setWeakPropagatedAttrs(CMDBWeakPropagatedAttrs[] newWeakAttrArray)
          Sets the propagated attributes of the weak relationship object.
 
Methods inherited from class com.bmc.cmdb.api.CMDBClass
addCustomCharacteristic, create, delete, find, findByKey, findByKey, getAbstract, getAttributeByName, getAttributes, getAuditInfo, getAuthor, getCategorizationSubclass, getClassFormName, getClassHiddenPerms, getClassVisiblePerms, getCustomCharacteristic, getCustomCharacteristicMap, getDescription, getFinal, getId, getIndexes, getKeyAttributeNames, getKeyAttributes, getNameKey, getSingleton, getSuperclassKey, removeAllCustomCharacteristic, removeCustomCharacteristic, setAbstract, setAttributes, setAuditInfo, setAuthor, setCategorizationSubclass, setClassHiddenPerms, setClassVisiblePerms, setDescription, setFinal, setIndexes, setNameKey, setNewNameKey, setSingleton, update
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CMDB_CLASS_RELATIONSHIP_CARDINALITY_NONE

public static final int CMDB_CLASS_RELATIONSHIP_CARDINALITY_NONE
Specifies that the cardinality is none.

See Also:
Constant Field Values

CMDB_CLASS_RELATIONSHIP_CARDINALITY_1_1

public static final int CMDB_CLASS_RELATIONSHIP_CARDINALITY_1_1
Specifies that the cardinality is one-to-one, which means that this instance of the relationship class can exist between one instance of the source class and one instance of the destination class.

See Also:
Constant Field Values

CMDB_CLASS_RELATIONSHIP_CARDINALITY_MANY_1

public static final int CMDB_CLASS_RELATIONSHIP_CARDINALITY_MANY_1
Specifies that the cardinality is many-to-one, which means that this instance of the relationship class can exist between multiple instances of the source class and one instance of the destination class.

See Also:
Constant Field Values

CMDB_CLASS_RELATIONSHIP_CARDINALITY_1_MANY

public static final int CMDB_CLASS_RELATIONSHIP_CARDINALITY_1_MANY
Specifies that the cardinality is one-to-many, which means that this instance of the relationship class can exist between one instance of the source class and multiple instances of the destination class.

See Also:
Constant Field Values

CMDB_CLASS_RELATIONSHIP_CARDINALITY_MANY_MANY

public static final int CMDB_CLASS_RELATIONSHIP_CARDINALITY_MANY_MANY
Specifies that the cardinality is many-to-many, which means that this instance of the relationship class can exist between multiple instances of the source class and multiple instances of the destination class.

See Also:
Constant Field Values
Constructor Detail

CMDBRelationship

public CMDBRelationship(CMDBClassNameKey relClassKey,
                        CMDBClassNameKey aSuperClassKey,
                        java.lang.String[] newRoleNames,
                        CMDBClassNameKey[] newRelClassNames)
Defines a relationship class with the class name and namespace information specified in the CMDBClassNameKey parameter, the relationship role names specified in the newRoleNames parameter, and the relationship class names specified in the newRelClassNames parameter.

Parameters:
relClassKey - relationship class key
aSuperClassKey - class key of the super class to which the relationship class is associated
newRoleNames - names of the roles of the relationship. The role names are for the source and destination members of the relationship. BMC Atrium CMDB prepends these role names to the attributes of a relationship class that pertain to its members. For example, on any common data model (CDM) relationship class, the attributes that hold the class IDs of its member CIs are named Source.ClassId and Destination.ClassId
newRelClassNames - names of the classes that are involved in the relationship
Throws:
java.lang.IllegalArgumentException - if the length of any role names are longer than Constants.AR_MAX_NAME_SIZE

CMDBRelationship

public CMDBRelationship(CMDBClassNameKey relClassKey,
                        java.lang.String classId,
                        CMDBClassNameKey aSuperClassKey,
                        java.lang.String[] newRoleNames,
                        CMDBClassNameKey[] newRelClassNames)
Defines a relationship instance with the class name and namespace information specified in the CMDBClassNameKey parameter, the relationship role names specified in the newRoleNames parameter, and the relationship class names specified in the newRelClassNames parameter.

Parameters:
relClassKey - relationship class key
classId - ID of the relationship class
aSuperClassKey - class key of the super class to which the relationship class is associated
newRoleNames - names of the roles of the relationship. The role names are for the source and destination members of the relationship. BMC Atrium CMDB prepends these role names to the attributes of a relationship class that pertain to its members. For example, on any Common Data Model (CDM) relationship class, the attributes that hold the class IDs of its member CIs are named Source.ClassId and Destination.ClassId.
newRelClassNames - the names of the classes that are involved in the relationship
Throws:
java.lang.IllegalArgumentException - if the length of any role names are longer than Constants.AR_MAX_NAME_SIZE

CMDBRelationship

public CMDBRelationship(CMDBClassNameKey aNameKey,
                        CMDBClassNameKey aSuperClassKey,
                        java.util.Map newAttributeMap,
                        CMDBIndex[] indexArray,
                        java.lang.String[] newRoleNames,
                        CMDBClassNameKey[] newRelClassNames,
                        int aCardinality,
                        boolean aWeakReference,
                        CMDBWeakPropagatedAttrs[] aWeakAttrArray,
                        boolean aCascadeDelete)
Creates a relationship instance with the specified class name and namespace, attributes, relationship role names, relationship class names, relationship cardinality, propagated attribute information, and cascading delete option.

Parameters:
aNameKey - name Key of CMDBclass object
aSuperClassKey - name key of the super CMDBclass
newAttributeMap - attributes of the relationship. The attributes are organized as a map that uses the attribute name as its map key and CMDBAttribute as its mapped value.
newRoleNames - the names of the roles of the relationship. The role names are for the source and destination members of the relationship. BMC Atrium CMDB prepends these role names to the attributes of a relationship class that pertain to its members. For example, on any CDM relationship class, the attributes that hold the class IDs of its member CIs are named Source.ClassId and Destination.ClassId
newRelClassNames - the names of the classes that are involved in the relationship
aCardinality - the cardinality of the relationship
aWeakReference - if role two is a weak reference
aWeakAttrArray - a propagated attribute array for the weak relationship
aCascadeDelete - if the relationship supports cascading deletion
Throws:
java.lang.IllegalArgumentException - if the length of any role names is longer than Constants.AR_MAX_NAME_SIZE
Method Detail

getRoleNames

public java.lang.String[] getRoleNames()
Gets a list of the names of the source and destination members of the relationship.

Returns:
the name of the Roles

getRelationClassNames

public CMDBClassNameKey[] getRelationClassNames()
Gets the list of class names to which the source member and destination member belong.

Returns:
the names of the two classes

getCardinality

public int getCardinality()
Gets the cardinality of the relationship.

Returns:
cardinality of the relationship

isRole2WeakReference

public boolean isRole2WeakReference()
Tells if role two is a weak reference. If this is true, role two is a weak entity and it uses role one's primary key as part of its own key. This is applicable only if the cardinality is one-to-one or one-to-many.

Returns:
Boolean value that indicates role two is a weak reference

getWeakPropagatedAttrs

public CMDBWeakPropagatedAttrs[] getWeakPropagatedAttrs()
Gets a list of the propagated attributes of the weak relationship.

Returns:
propagated attributes

isCascadeDelete

public boolean isCascadeDelete()
Tells if the relationship supports cascading deletion. This attribute is applicable only if the cardinality is one-to-one or one-to-many. If this attribute is true and the cardinality is one of the applicable values, all related role two instances are deleted when the role one instance is deleted.

Returns:
Boolean value indicating whether the relationship supports cascading delete

setRole2WeakReference

public void setRole2WeakReference(boolean newWeakReference)
Sets the role 2 instance to be a weak reference. The newWeakReference parameter is a constant defined in BMC Atrium CMDB.

Parameters:
newWeakReference - the weak reference property to be set

setWeakPropagatedAttrs

public void setWeakPropagatedAttrs(CMDBWeakPropagatedAttrs[] newWeakAttrArray)
Sets the propagated attributes of the weak relationship object. The newWeakAttrArray parameter is a constant defined in BMC Atrium CMDB.

Parameters:
newWeakAttrArray - the new weak attributes of the weak relationship

setCascadeDelete

public void setCascadeDelete(boolean newCascadeDelete)
Sets the cascading delete attribute of the CMDBRelationship object. The newCascadeDelete parameter is a constant defined in BMC Atrium CMDB.

Parameters:
newCascadeDelete - the cascading delete property to be set

setCardinality

public void setCardinality(int cardinality)
Sets the cardinality attribute of the CMDBRelationship object. The cardinality parameter is a constant defined in BMC Atrium CMDB. To change the cardinality of an existing relationship object, the following restrictions must be applied:

Parameters:
cardinality - the cardinality property to be set


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