Enterprise Information Portal APIs

com.ibm.mm.sdk.common
Class DKForeignKeyDefICM

java.lang.Object
  |
  +--com.ibm.mm.sdk.common.DKForeignKeyDefICM

public class DKForeignKeyDefICM
extends java.lang.Object

Use This class to represent a foregin key definition for a component type.


Constructor Summary
DKForeignKeyDefICM()
          Default constructor construct a foreign key object.
DKForeignKeyDefICM(dkDatastore ds)
          Construct a foreign key object and initialize it with the datastore.
DKForeignKeyDefICM(DKForeignKeyDefICM foreignKey)
          A copy constructor for the foreign key object which make a copy of the specified foreign key.
 
Method Summary
 void addSrcAndTgtAttrName(java.lang.String srcAttrName, java.lang.String tgtAttrName, int columnSeq)
          Adds a source attribute and the corresponding target attribute or column name to this foreign key.
 java.lang.String getConstraintName()
          Gets the constraint name for this foreign key.
 dkDatastore getDatastore()
          Gets the datastore where the item type, whose foreign keys this object represents is defined.
 short getDeleteRule()
          Gets the delete rule for this foreign key constraint See setDeleteRule(short) in class for the detail information
 java.lang.String getSourceCompTypeName()
          Gets source component type name for which this foreign key is defined
 java.lang.String getTargetCompTypeName()
          Gets the target component type name which this foreign key references.
 java.lang.String getTargetSchemaName()
          Gets the target schema name to which the target external table belong to.
 java.lang.String getTargetTableName()
          Gets the target table name which this foreign key references.
 short getUpdateRule()
          Gets the update rule for this foreign key constraint
 java.util.Vector listForeignKeyAttrInfo()
          List source and target attributes and column sequence from this foreign key
 java.lang.String[] listSourceAttrNames()
          Lists source attributes from this foreign key
 java.lang.String[] listTargetAttrNames()
          Lists target attributes from this foreign key
 void removeSourceAttrName(java.lang.String srcAttrName)
          Removes a source attribute from this foreign key
 void setConstraintName(java.lang.String constraintName)
          Sets a constraint name for this foreign key.
 void setDatastore(dkDatastore ds)
          Sets the datastore where the item type, whose foreign keys this object represents is defined.
 void setDeleteRule(short deleteRule)
          Sets the delete rule for this foreign key constraint
 void setSourceCompTypeName(java.lang.String srcCompTypeName)
          Sets the source component type name for which this foreign key if defined.
 void setTargetCompTypeName(java.lang.String tgtCompTypeName)
          Sets the target component type name which this foreign key reference.
 void setTargetSchemaName(java.lang.String tgtSchemaName)
          Sets the target schema name to which the target table belongs to.
 void setTargetTableName(java.lang.String tgtTableName)
          Sets the target table name which this foreign key references.
 void setUpdateRule(short updateRule)
          Sets the update rule for this foreign key constraint See #setDeleteRule(short) in this class for the detail information
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DKForeignKeyDefICM

public DKForeignKeyDefICM()
Default constructor construct a foreign key object.

DKForeignKeyDefICM

public DKForeignKeyDefICM(dkDatastore ds)
Construct a foreign key object and initialize it with the datastore. ds - A reference to a datastore object where the item type, whose foreign keys this object represents is defined.

DKForeignKeyDefICM

public DKForeignKeyDefICM(DKForeignKeyDefICM foreignKey)
A copy constructor for the foreign key object which make a copy of the specified foreign key.
Parameters:
foreignKey - - a foreign key object
Method Detail

setDatastore

public void setDatastore(dkDatastore ds)
Sets the datastore where the item type, whose foreign keys this object represents is defined.
Parameters:
ds - - an ICM datastore

getDatastore

public dkDatastore getDatastore()
Gets the datastore where the item type, whose foreign keys this object represents is defined.
Returns:
ds - an ICM datastore

setSourceCompTypeName

public void setSourceCompTypeName(java.lang.String srcCompTypeName)
Sets the source component type name for which this foreign key if defined. This name can be up to 15 characters.
Parameters:
srcCompTypeName - - source component type name

getSourceCompTypeName

public java.lang.String getSourceCompTypeName()
Gets source component type name for which this foreign key is defined
Returns:
source component type name

setTargetCompTypeName

public void setTargetCompTypeName(java.lang.String tgtCompTypeName)
                           throws DKException
Sets the target component type name which this foreign key reference. This name can be up to 15 characters.
Parameters:
tgtCompTypeName - - target component type name
Throws:
if - this target component type already exists in this foreign key object.

getTargetCompTypeName

public java.lang.String getTargetCompTypeName()
Gets the target component type name which this foreign key references.
Returns:
target component type name

setTargetTableName

public void setTargetTableName(java.lang.String tgtTableName)
                        throws DKException
Sets the target table name which this foreign key references. The target table name can be up to 15 characters long. A target component type can be used if the foreign key references an external database table. The schema name to which this table belongs should also be set.
Parameters:
tgtTableName - - target table name. SetTargetCompTypeName and setTargetTableName are mutually exclusive. The foreign key can either reference a component type which is internal to the ICM datastore or a external database table.
Throws:
if - this target table name already exists in this foreign key object.

getTargetTableName

public java.lang.String getTargetTableName()
Gets the target table name which this foreign key references.
Returns:
target table name

setTargetSchemaName

public void setTargetSchemaName(java.lang.String tgtSchemaName)
Sets the target schema name to which the target table belongs to. The target schema name should be specified if this foreign references an external table. THe schema name can be up to 15 characters.
Parameters:
tgtShemaName - - target schema name

getTargetSchemaName

public java.lang.String getTargetSchemaName()
Gets the target schema name to which the target external table belong to. The target schema name is not available if the target is a component type name.
Returns:
target schema name

setConstraintName

public void setConstraintName(java.lang.String constraintName)
Sets a constraint name for this foreign key. This name can be up to 18 characters
Parameters:
constraintName - - constraint name

getConstraintName

public java.lang.String getConstraintName()
Gets the constraint name for this foreign key.
Returns:
constraint name

setDeleteRule

public void setDeleteRule(short deleteRule)
Sets the delete rule for this foreign key constraint
Parameters:
the - delete rule for this foreign key constraint. The possible values are
  • DKConstantICM.DK_ICM_DELETE_RULE_NO_ACTION No action. Delete is prevented and an exception is thrown
  • DKConstantICM.DK_ICM_DELETE_RULE_SET_NULLSet null. The source component type is deleted and relationship with the target component type is removed.
  • DKConstantICM.DK_ICM_DELETE_RULE_CASCADECascade on deletion. The source and target component type are both deleted.
  • DKConstantICM.DK_ICM_DELETE_RULE_RESTRICTRestrict on deletion. Same as no action

getDeleteRule

public short getDeleteRule()
Gets the delete rule for this foreign key constraint See setDeleteRule(short) in class for the detail information
Returns:
delete rule for this foreign key constraint

setUpdateRule

public void setUpdateRule(short updateRule)
Sets the update rule for this foreign key constraint See #setDeleteRule(short) in this class for the detail information
Parameters:
updateRule - - update rule for this foreign key constraint

getUpdateRule

public short getUpdateRule()
Gets the update rule for this foreign key constraint
Returns:
update rule for this foreign key constraint
See Also:
setDeleteRule(short)

addSrcAndTgtAttrName

public void addSrcAndTgtAttrName(java.lang.String srcAttrName,
                                 java.lang.String tgtAttrName,
                                 int columnSeq)
                          throws DKAlreadyExistException,
                                 DKException,
                                 java.lang.Exception
Adds a source attribute and the corresponding target attribute or column name to this foreign key. The target attribute name is specified if the target is a component type name and column name is specified if the target is an external table.
Parameters:
srcAttrName - - the source attribute name in the format of attrGroupName.attrName
tgtAttrName - - the target attribute name in the format of attrGroupName.attrName
columnSeq - - Numeric position of the column in the key. The sequence must start with 0 and be incremented by one for each column of the key.
Throws:
if - the source attribute already exists in this foreign key object.

removeSourceAttrName

public void removeSourceAttrName(java.lang.String srcAttrName)
                          throws DKNotExistException,
                                 DKException
Removes a source attribute from this foreign key
Parameters:
attrName - name of the attribute need to be removed

listSourceAttrNames

public java.lang.String[] listSourceAttrNames()
                                       throws DKException
Lists source attributes from this foreign key
Returns:
an array of strings, which are the names of the source attributes

listTargetAttrNames

public java.lang.String[] listTargetAttrNames()
                                       throws DKException
Lists target attributes from this foreign key
Returns:
an array of strings, which are the names of the target attributes

listForeignKeyAttrInfo

public java.util.Vector listForeignKeyAttrInfo()
List source and target attributes and column sequence from this foreign key
Returns:
a vector containing String[3] objects String[0] is column sequence String[1] is source attribute String[2] is target attribute See addSrcAndTgtAttrName() in this class for the detail information

EIP Java APIs

(c) Copyright International Business Machines Corporation 1996, 2002. IBM Corp. All rights reserved.