|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.torque.engine.database.model.ForeignKey
public class ForeignKey
A class for information about foreign keys of a table.
Field Summary | |
---|---|
private List |
foreignColumns
|
private String |
foreignTableName
|
private List |
localColumns
|
private String |
name
|
private static String |
NONE
|
private String |
onDelete
|
private String |
onUpdate
|
private Map |
options
|
private Table |
parentTable
|
private static String |
SETNULL
|
Constructor Summary | |
---|---|
ForeignKey()
|
Method Summary | |
---|---|
void |
addOption(String key,
String value)
Add an XML Specified option key/value pair to this element's option set. |
void |
addReference(Attributes attrib)
Adds a new reference entry to the foreign key |
void |
addReference(String local,
String foreign)
Adds a new reference entry to the foreign key |
String |
getForeignColumnNames()
Returns a comma delimited string of foreign column names |
List |
getForeignColumns()
Returns the list of foreign column names. |
Hashtable |
getForeignLocalMapping()
Utility method to get foreign column names to local column names mapping for this foreign key. |
String |
getForeignTableName()
Get the foreignTableName of the FK |
String |
getLocalColumnNames()
Returns a comma delimited string of local column names |
List |
getLocalColumns()
Returns the list of local column names. |
Hashtable |
getLocalForeignMapping()
Utility method to get local column names to foreign column names mapping for this foreign key. |
String |
getName()
Returns the name attribute. |
String |
getOnDelete()
Returns the onDelete attribute |
String |
getOnUpdate()
Returns the onUpdate attribute |
String |
getOption(String key)
Get the value that was associated with this key in an XML option element. |
Map |
getOptions()
Gets the full ordered hashtable array of items specified by XML option statements under this element. |
Table |
getTable()
Get the parent Table of the foreign key |
String |
getTableName()
Returns the name of the table the foreign key is in |
boolean |
hasOnDelete()
Returns whether or not the onDelete attribute is set |
boolean |
hasOnUpdate()
Returns whether or not the onUpdate attribute is set |
void |
loadFromXML(Attributes attrib)
Imports foreign key from an XML specification |
private String |
normalizeFKey(String attrib)
Normalizes the input of onDelete, onUpdate attributes |
void |
setForeignTableName(String tableName)
Set the foreignTableName of the FK |
void |
setName(String name)
Sets the name attribute. |
void |
setOnDelete(String value)
Sets the onDelete attribute |
void |
setOnUpdate(String value)
Sets the onUpdate attribute |
void |
setTable(Table parent)
Set the parent Table of the foreign key |
String |
toString()
String representation of the foreign key. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private String foreignTableName
private String name
private String onUpdate
private String onDelete
private Table parentTable
private List localColumns
private List foreignColumns
private Map options
private static final String NONE
private static final String SETNULL
Constructor Detail |
---|
public ForeignKey()
Method Detail |
---|
public void loadFromXML(Attributes attrib)
attrib
- the xml attributesprivate String normalizeFKey(String attrib)
attrib
- the attribute to normalize
public boolean hasOnUpdate()
public boolean hasOnDelete()
public String getOnUpdate()
public String getOnDelete()
public void setOnDelete(String value)
value
- the onDelete attributepublic void setOnUpdate(String value)
value
- the onUpdate attributepublic String getName()
public void setName(String name)
name
- the namepublic String getForeignTableName()
public void setForeignTableName(String tableName)
tableName
- the name of the foreign tablepublic void setTable(Table parent)
parent
- the tablepublic Table getTable()
public String getTableName()
public void addReference(Attributes attrib)
attrib
- the xml attributespublic void addReference(String local, String foreign)
local
- name of the local columnforeign
- name of the foreign columnpublic String getLocalColumnNames()
public String getForeignColumnNames()
public List getLocalColumns()
public Hashtable getLocalForeignMapping()
public List getForeignColumns()
public Hashtable getForeignLocalMapping()
public String toString()
toString
in class Object
public void addOption(String key, String value)
key
- the key of the option.value
- the value of the option.public String getOption(String key)
key
- the key of the option.
public Map getOptions()
Note, this is not thread save but since it's only used for generation which is single threaded, there should be minimum danger using this in Velocity.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |