Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-03

oracle.javatools.db
Class FKConstraint

java.lang.Object
  extended by oracle.javatools.db.AbstractDBObject
      extended by oracle.javatools.db.AbstractChildDBObject
          extended by oracle.javatools.db.Constraint
              extended by oracle.javatools.db.ColumnConstraint
                  extended by oracle.javatools.db.FKConstraint
All Implemented Interfaces:
ChildDBObject, DBObject, Copyable, DynamicPropertySet

public class FKConstraint
extends ColumnConstraint

A FKConstraint represents a Foreign Key Constraint. A foreign key constraint requires values in the constrained table to match values in another table.

An FKConstraint contains a reference to a UniqueConstraint. This referenced constraint determines the valid values for the columns constrained.


Nested Class Summary
 
Nested classes/interfaces inherited from class oracle.javatools.db.AbstractDBObject
AbstractDBObject.ChildSupport
 
Field Summary
static java.lang.String CONSTRAINT_TYPE
           
static int ON_DELETE_CASCADE
           
static int ON_DELETE_NONE
          Deprecated. use ON_DELETE_RESTRICT instead
static int ON_DELETE_RESTRICT
           
static int ON_DELETE_SET_NULL
           
 
Fields inherited from class oracle.javatools.db.Constraint
TYPE
 
Fields inherited from interface oracle.javatools.db.DBObject
COMMENT
 
Constructor Summary
FKConstraint()
          Constructs a new FKConstraint.
FKConstraint(java.lang.String name, Relation relation)
          Constructs a new FKConstraint with the specified name on the specified relation.
 
Method Summary
 DBObject copyTo(DBObject target, DBObject copyParent, IDPolicy idPolicy)
          Internal copy method used by the API to perform copy operations.
protected  void copyToImpl(FKConstraint copy, Relation copyParent, IDPolicy idPolicy)
           
 boolean equals(java.lang.Object target)
           
protected  boolean equalsImpl(FKConstraint target)
           
 java.lang.String getConstraintType()
          Retrieves the type of constraint represented by this instance.
 int getDeleteMode()
          Whether this constraint specifies CASCADE DELETE.
 DBObjectID getReferenceID()
          Retrieves the Object ID of the referenced unique constraint.
protected  void getReferenceIDsImpl(java.util.Collection<DBObjectID> refs)
          Used by the final getReferenceID() implementation.
 boolean isReferencedSchemaIgnored()
          Should the generated DDL mention the referenced Schema
 boolean replaceReferenceIDs(java.util.Map<DBObjectID,DBObjectID> idMap)
          Override in subclasses to replace reference IDs as appropriate.
 void setDeleteMode(int onDelete)
          Sets whether this constraint specifies CASCADE DELETE.
 void setIgnorReferencedSchema(boolean flag)
          Flag that the generated DDL must not to mention the referenced Schema
 void setReferenceID(DBObjectID id)
          Sets the Object ID of the referenced unique constraint.
 
Methods inherited from class oracle.javatools.db.ColumnConstraint
addColumn, copyToImpl, equalsImpl, getColumnIDs, getColumns, isConstrained, removeColumn, setColumnIDs, setColumns
 
Methods inherited from class oracle.javatools.db.Constraint
copyToImpl, equalsImpl, getConstraints, getRelation, getType, isEnabled, setEnabled, setRelation
 
Methods inherited from class oracle.javatools.db.AbstractChildDBObject
copyToImpl, findParent, getParent, setParent
 
Methods inherited from class oracle.javatools.db.AbstractDBObject
changeParent, compareToImpl, copyObject, copyTo, copyTo, copyTo, copyToImpl, equalsImpl, findOwnedObject, findOwnedObject, findOwnedObject, getChildSupport, getID, getName, getOwnedObjects, getOwnedObjects, getOwnedObjectsImpl, getProperties, getProperty, getProperty, getReferenceIDs, hashCode, includeOwnedObject, includesType, includesType, removeThisAsParent, setID, setName, setProperties, setProperty, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface oracle.javatools.db.DBObject
copyTo, copyTo, copyTo, findOwnedObject, findOwnedObject, getID, getName, getOwnedObjects, getOwnedObjects, getReferenceIDs, setID, setName
 
Methods inherited from interface oracle.javatools.util.DynamicPropertySet
getProperties, getProperty, getProperty, setProperties, setProperty
 

Field Detail

CONSTRAINT_TYPE

public static final java.lang.String CONSTRAINT_TYPE
See Also:
Constant Field Values

ON_DELETE_RESTRICT

public static final int ON_DELETE_RESTRICT
See Also:
Constant Field Values

ON_DELETE_CASCADE

public static final int ON_DELETE_CASCADE
See Also:
Constant Field Values

ON_DELETE_SET_NULL

public static final int ON_DELETE_SET_NULL
See Also:
Constant Field Values

ON_DELETE_NONE

@Deprecated
public static final int ON_DELETE_NONE
Deprecated. use ON_DELETE_RESTRICT instead
See Also:
Constant Field Values
Constructor Detail

FKConstraint

public FKConstraint()
Constructs a new FKConstraint.


FKConstraint

public FKConstraint(java.lang.String name,
                    Relation relation)
Constructs a new FKConstraint with the specified name on the specified relation.

Parameters:
name - a string containing the name of the constraint
relation - the relation being constrained.
Method Detail

copyTo

public DBObject copyTo(DBObject target,
                       DBObject copyParent,
                       IDPolicy idPolicy)
Description copied from class: AbstractDBObject
Internal copy method used by the API to perform copy operations. All objects must implement this method if they are instantiable objects. Abstract objects (e.g. Relation) must NOT implement this method. The implementation should delegate to the copyToImpl method to copy the actual properties.

This method does not fix internal reference ids on copy. That is done by the calling DBObject.copyTo(DBObject, IDPolicy) method.

Specified by:
copyTo in class AbstractDBObject
See Also:
DBObject.copyTo(java.lang.Object), DBObject.copyTo(DBObject, boolean), AbstractDBObject.copyToImpl(oracle.javatools.db.AbstractDBObject, oracle.javatools.db.DBObject, oracle.javatools.db.IDPolicy)

equals

public boolean equals(java.lang.Object target)
Overrides:
equals in class java.lang.Object

copyToImpl

protected void copyToImpl(FKConstraint copy,
                          Relation copyParent,
                          IDPolicy idPolicy)

equalsImpl

protected boolean equalsImpl(FKConstraint target)

setIgnorReferencedSchema

public void setIgnorReferencedSchema(boolean flag)
Flag that the generated DDL must not to mention the referenced Schema


isReferencedSchemaIgnored

public boolean isReferencedSchemaIgnored()
Should the generated DDL mention the referenced Schema


setReferenceID

public void setReferenceID(DBObjectID id)
Sets the Object ID of the referenced unique constraint.

Parameters:
id - The DBObjectID of the referenced constraint

getReferenceID

public DBObjectID getReferenceID()
Retrieves the Object ID of the referenced unique constraint.

Returns:
The DBObjectID of the referenced constraint

getConstraintType

public java.lang.String getConstraintType()
Description copied from class: Constraint
Retrieves the type of constraint represented by this instance. Valid constraint types can vary depending on the database. Examples of constraint types include primary key constraints, foreign key constraints, and check constraints.

Specified by:
getConstraintType in class Constraint
Returns:
a string value indicating the type of constraint.

getDeleteMode

public int getDeleteMode()
Whether this constraint specifies CASCADE DELETE. A foreign key with cascading delete indicates that the deleting of a value from the parent table should delete all rows in the child table that reference that value.

Returns:
a boolean value indicating whether this constraint specifies a cascading delete.

setDeleteMode

public void setDeleteMode(int onDelete)
Sets whether this constraint specifies CASCADE DELETE. A foreign key with cascading delete indicates that the deleting of a value from the parent table should delete all rows in the child table that reference that value.

Parameters:
onDelete - a boolean value indicating whether this constraint specifies a cascading delete.

getReferenceIDsImpl

protected void getReferenceIDsImpl(java.util.Collection<DBObjectID> refs)
Description copied from class: AbstractDBObject
Used by the final getReferenceID() implementation. The list should not contain null values, or be null. Subclasses should start with super.getReferenceIDsImpl() and then add to the passed list as appopriate.

Overrides:
getReferenceIDsImpl in class ColumnConstraint
Parameters:
refs - the collection of ids this object references

replaceReferenceIDs

public boolean replaceReferenceIDs(java.util.Map<DBObjectID,DBObjectID> idMap)
Description copied from class: AbstractDBObject
Override in subclasses to replace reference IDs as appropriate. Always call super in the overridden implementation to make sure the default implementation (which checks the property map) is called.

Specified by:
replaceReferenceIDs in interface DBObject
Overrides:
replaceReferenceIDs in class ColumnConstraint
Parameters:
idMap - key = old DBObjectID, value = new DBObjectID
Returns:
true if any ids were replaced.

Oracle Fusion Middleware Java API Reference for Oracle Extension SDK Reference
11g Release 1 (11.1.1)

E13403-03

Copyright © 1997, 2009, Oracle. All rights reserved.