dlr 01/08/17 15:04:26
Modified: src/java/org/apache/torque/engine/database/model
ForeignKey.java
Log:
Added name attribute.
Revision Changes Path
1.2 +27 -5
jakarta-turbine-torque/src/java/org/apache/torque/engine/database/model/ForeignKey.java
Index: ForeignKey.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/engine/database/model/ForeignKey.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -u -r1.1 -r1.2
--- ForeignKey.java 2001/08/02 05:08:31 1.1
+++ ForeignKey.java 2001/08/17 22:04:26 1.2
@@ -63,11 +63,13 @@
* A Class for information about foreign keys of a table
*
* @author <a href="mailto:[EMAIL PROTECTED]">Fedor</a>
- * @version $Id: ForeignKey.java,v 1.1 2001/08/02 05:08:31 jvanzyl Exp $
+ * @author <a href="mailto:[EMAIL PROTECTED]">Daniel Rall</a>
+ * @version $Id: ForeignKey.java,v 1.2 2001/08/17 22:04:26 dlr Exp $
*/
public class ForeignKey
{
private String foreignTableName;
+ private String name;
private String onUpdate;
private String onDelete;
private Table parentTable;
@@ -91,6 +93,7 @@
public void loadFromXML (Attributes attrib)
{
foreignTableName = attrib.getValue("foreignTable");
+ name = attrib.getValue("name");
onUpdate = attrib.getValue("onUpdate");
onDelete = attrib.getValue("onDelete");
onUpdate = normalizeFKey(onUpdate);
@@ -165,6 +168,22 @@
}
/**
+ * Returns the name attribute.
+ */
+ public String getName()
+ {
+ return name;
+ }
+
+ /**
+ * Sets the name attribute.
+ */
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ /**
* Get the foreignTableName of the FK
*/
public String getForeignTableName()
@@ -307,16 +326,19 @@
{
StringBuffer result = new StringBuffer();
result.append(" <foreign-key foreignTable=\"")
- .append(foreignTableName)
- .append("\"");
- result.append(">\n");
+ .append(getForeignTableName())
+ .append("\" name=\"")
+ .append(getName())
+ .append("\">\n");
- for (int i=0; i<localColumns.size(); i++)
+ for (int i = 0; i < localColumns.size(); i++)
+ {
result.append(" <reference local=\"")
.append(localColumns.get(i))
.append("\" foreign=\"")
.append(foreignColumns.get(i))
.append("\"/>\n");
+ }
result.append(" </foreign-key>\n");
return result.toString();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]