com.remedy.cmdb.api
Class CMDBRelationship

java.lang.Object
  extended bycom.remedy.cmdb.api.CMDBClass
      extended bycom.remedy.cmdb.api.CMDBRelationship
All Implemented Interfaces:
java.io.Serializable

public class CMDBRelationship
extends CMDBClass
implements java.io.Serializable

The CMDBRelationship class defines the relationship of CMDBclass objects. It is a subclass of CMDBClass.

See Also:
Serialized Form

Field Summary
static int CMDB_CLASS_RELATIONSHIP_CARDINALITY_1_1
          Cardinality (relationship) is one-to-one.
static int CMDB_CLASS_RELATIONSHIP_CARDINALITY_1_MANY
          Cardinality (relationship) is one-to-many.
static int CMDB_CLASS_RELATIONSHIP_CARDINALITY_MANY_1
          Cardinality (relationship) is many-to-one.
static int CMDB_CLASS_RELATIONSHIP_CARDINALITY_MANY_MANY
          Cardinality (relationship) is many-to-many.
static int CMDB_CLASS_RELATIONSHIP_CARDINALITY_NONE
          No cardinality.
 
Fields inherited from class com.remedy.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)
          Constructor to create an CMDBRelationship object with the provided information.
CMDBRelationship(CMDBClassNameKey relClassKey, CMDBClassNameKey aSuperClassKey, java.lang.String[] newRoleNames, CMDBClassNameKey[] newRelClassNames)
          Creates an CMDBRelationship object with minimum information.
CMDBRelationship(CMDBClassNameKey relClassKey, java.lang.String classId, CMDBClassNameKey aSuperClassKey, java.lang.String[] newRoleNames, CMDBClassNameKey[] newRelClassNames)
          Creates an CMDBRelationship object with minimum information.
 
Method Summary
 int getCardinality()
          Gets the cardinality of the relationship.
 CMDBClassNameKey[] getRelationClassNames()
          Gets the name of the two classes that are involved in the relationship.
 java.lang.String[] getRoleNames()
          Gets the name of the Roles of the relationship.
 CMDBWeakPropagatedAttrs[] getWeakPropagatedAttrs()
          Get propagated attributes of the weak relationship object
 boolean isCascadeDelete()
          Tells if the relationship supports cascade deletion.
 boolean isRole2WeakReference()
          Tells if role two is a weak reference.
 void setCardinality(int cardinality)
          Sets the cardinality property of the CMDBRelationship object.
 void setCascadeDelete(boolean newCascadeDelete)
          Sets the cascade deletion property of the CMDBRelationship object.
 void setRole2WeakReference(boolean newWeakReference)
          Sets role2 to be a weak reference.
 void setWeakPropagatedAttrs(CMDBWeakPropagatedAttrs[] newWeakAttrArray)
          Set propagated attributes of the weak relationship object
 
Methods inherited from class com.remedy.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
No cardinality.

See Also:
Constant Field Values

CMDB_CLASS_RELATIONSHIP_CARDINALITY_1_1

public static final int CMDB_CLASS_RELATIONSHIP_CARDINALITY_1_1
Cardinality (relationship) is one-to-one.

See Also:
Constant Field Values

CMDB_CLASS_RELATIONSHIP_CARDINALITY_MANY_1

public static final int CMDB_CLASS_RELATIONSHIP_CARDINALITY_MANY_1
Cardinality (relationship) is many-to-one.

See Also:
Constant Field Values

CMDB_CLASS_RELATIONSHIP_CARDINALITY_1_MANY

public static final int CMDB_CLASS_RELATIONSHIP_CARDINALITY_1_MANY
Cardinality (relationship) is one-to-many.

See Also:
Constant Field Values

CMDB_CLASS_RELATIONSHIP_CARDINALITY_MANY_MANY

public static final int CMDB_CLASS_RELATIONSHIP_CARDINALITY_MANY_MANY
Cardinality (relationship) is many-to-many.

See Also:
Constant Field Values
Constructor Detail

CMDBRelationship

public CMDBRelationship(CMDBClassNameKey relClassKey,
                        CMDBClassNameKey aSuperClassKey,
                        java.lang.String[] newRoleNames,
                        CMDBClassNameKey[] newRelClassNames)
Creates an CMDBRelationship object with minimum information.

Parameters:
relClassKey - a relationship class key
aSuperClassKey - the class key of the super class
newRoleNames - the names of the roles of the relationship
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 relClassKey,
                        java.lang.String classId,
                        CMDBClassNameKey aSuperClassKey,
                        java.lang.String[] newRoleNames,
                        CMDBClassNameKey[] newRelClassNames)
Creates an CMDBRelationship object with minimum information.

Parameters:
relClassKey - a relationship class key
classId - the id of the class
aSuperClassKey - the class key of the super class
newRoleNames - the names of the roles of the relationship
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)
Constructor to create an CMDBRelationship object with the provided information.

Parameters:
aNameKey - the nameKey of CMDBclass object
aSuperClassKey - the 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
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 attributes array for the weak relationship
aCascadeDelete - if the relationshiop supports cascade deletion
Throws:
java.lang.IllegalArgumentException - if the length of any role names are longer than Constants.AR_MAX_NAME_SIZE
Method Detail

getRoleNames

public java.lang.String[] getRoleNames()
Gets the name of the Roles of the relationship.

Returns:
the name of the Roles

getRelationClassNames

public CMDBClassNameKey[] getRelationClassNames()
Gets the name of the two classes that are involved in the relationship.

Returns:
the name of the two classes

getCardinality

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

Returns:
cardinality the cardinality property

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. Applicable only if the cardinality is one-to-one or one-to-many.

Returns:
boolean the weak reference property

getWeakPropagatedAttrs

public CMDBWeakPropagatedAttrs[] getWeakPropagatedAttrs()
Get propagated attributes of the weak relationship object

Returns:
propagated attributes

isCascadeDelete

public boolean isCascadeDelete()
Tells if the relationship supports cascade deletion. This attibute is applicable only if the cardinality is one-to-one or one-to-many. If this attibute is true and the cardinality is one of the applicable values, the deletion on the role one instance also deletes all related role two instances.

Returns:
boolean

setRole2WeakReference

public void setRole2WeakReference(boolean newWeakReference)
Sets role2 to be a weak reference.

Parameters:
newWeakReference - the weak reference property to be set

setWeakPropagatedAttrs

public void setWeakPropagatedAttrs(CMDBWeakPropagatedAttrs[] newWeakAttrArray)
Set propagated attributes of the weak relationship object

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

setCascadeDelete

public void setCascadeDelete(boolean newCascadeDelete)
Sets the cascade deletion property of the CMDBRelationship object.

Parameters:
newCascadeDelete - the cascade deletion property to be set

setCardinality

public void setCardinality(int cardinality)
Sets the cardinality property of the CMDBRelationship object. To change the cardinality of an existing relationship object, the following restriction must be applied: old value = one-to-one ------ new value can be = one-to-many, many-to-one, or many-to-many old value = one-to-many ------- new value can be = many-to-many old value = many-to-one ------- new value can be = many-to-many old value = many-to-many ------ no new value can be set

Parameters:
cardinality - the cardinality property to be set