dlr 01/08/17 14:45:24
Modified: src/java/org/apache/torque/engine/database/model Index.java
Log:
* Removed isUnique instanc member -- it doesn't exist in the DTD, so
we'll assume that it isn't in use.
* Renamed some methods by deprecating old version and adding new
version.
* Added name parameter to toString() XML generation method.
Revision Changes Path
1.7 +60 -18
jakarta-turbine-torque/src/java/org/apache/torque/engine/database/model/Index.java
Index: Index.java
===================================================================
RCS file:
/home/cvs/jakarta-turbine-torque/src/java/org/apache/torque/engine/database/model/Index.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -u -r1.6 -r1.7
--- Index.java 2001/08/17 21:08:05 1.6
+++ Index.java 2001/08/17 21:45:24 1.7
@@ -67,7 +67,7 @@
*
* @author <a href="mailto:[EMAIL PROTECTED]">Jason van Zyl</a>
* @author <a href="mailto:[EMAIL PROTECTED]>Daniel Rall</a>
- * @version $Id: Index.java,v 1.6 2001/08/17 21:08:05 dlr Exp $
+ * @version $Id: Index.java,v 1.7 2001/08/17 21:45:24 dlr Exp $
*/
public class Index
{
@@ -76,7 +76,6 @@
private String indexName;
private Table parentTable;
private List indexColumns;
- private boolean isUnique;
/**
* Creates a new instance with default characteristics (no name or
@@ -85,7 +84,6 @@
public Index()
{
indexColumns = new ArrayList(3);
- isUnique = false;
}
/**
@@ -113,7 +111,7 @@
this.indexColumns = indexColumns;
if (DEBUG)
{
- System.out.println("Created Index named " + indexName +
+ System.out.println("Created Index named " + getName() +
" with " + indexColumns.size() +
" columns");
}
@@ -130,36 +128,60 @@
/**
* Imports index from an XML specification
*/
- public void loadFromXML (Attributes attrib)
+ public void loadFromXML(Attributes attrib)
{
indexName = attrib.getValue("name");
- isUnique = "true".equalsIgnoreCase(attrib.getValue("unique"));
}
/**
- * Get unique attribute of the index
- *
+ * @see #getUnique()
+ * @deprecated Use getUnique() instead.
*/
public boolean getIsUnique()
{
- return isUnique;
+ return getUnique();
}
/**
- * Get the name of the index
- *
+ * Returns the uniqueness of this index.
*/
+ public boolean getUnique()
+ {
+ return false;
+ }
+
+ /**
+ * @see #getName()
+ * @deprecated Use getName() instead.
+ */
public String getIndexName()
{
+ return getName();
+ }
+
+ /**
+ * Gets the name of this index.
+ */
+ public String getName()
+ {
return indexName;
}
+ /**
+ * @see #setName(String name)
+ * @deprecated Use setName(String name) instead.
+ */
+ public void setIndexName(String name)
+ {
+ setName(name);
+ }
+
/**
- * Set the name of the index
+ * Set the name of this index.
*/
- public void setIndexName(String indexName)
+ public void setName(String name)
{
- this.indexName = indexName;
+ this.indexName = name;
}
/**
@@ -195,10 +217,19 @@
}
/**
+ * @see #getColumnList()
+ * @deprecated Use getColumnList() instead.
+ */
+ public String getIndexColumnList()
+ {
+ return getColumnList();
+ }
+
+ /**
* Return a comma delimited string of the columns which compose
* this index.
*/
- public String getIndexColumnList()
+ public String getColumnList()
{
Column c = (Column) indexColumns.get(0);
StringBuffer res = new StringBuffer(c.getName());
@@ -211,10 +242,19 @@
}
/**
+ * @see #getColumns()
+ * @deprecated Use getColumns() instead.
+ */
+ public List getIndexColumns()
+ {
+ return getColumns();
+ }
+
+ /**
* Return the vector of local columns. You should not edit
* this vector.
*/
- public List getIndexColumns()
+ public List getColumns()
{
return indexColumns;
}
@@ -227,15 +267,17 @@
{
StringBuffer result = new StringBuffer();
result.append(" <index name=\"")
- .append(indexName)
+ .append(getName())
.append("\"");
result.append(">\n");
- for (int i=0; i<indexColumns.size(); i++)
+ for (int i = 0; i < indexColumns.size(); i++)
+ {
result.append(" <index-column name=\"")
.append(indexColumns.get(i))
.append("\"/>\n");
+ }
result.append(" </index>\n");
return result.toString();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]