Permalink
Browse files

Issue 238

Upgrade bristlecone TableHelper to generate new staging table format for Tungsten Replicator batch loading.
  • Loading branch information...
1 parent 48a3477 commit 3b7b16a172019c801d0dcc070ca9e73ec680a01c hodgesrm committed Jan 8, 2012
@@ -25,138 +25,162 @@
import com.continuent.bristlecone.utils.ToStringHelper;
/**
- * Definition of a SQL column.
+ * Definition of a SQL column.
*
* @author rhodges
*/
public class Column
{
- private String name;
- private int type;
- private int length;
- private int precision;
- private boolean isPrimaryKey;
- private boolean isAutoIncrement;
- private boolean indexed;
-
- /** Instantiate empty column to be filled out by accessors. */
- public Column()
- {
- }
-
- /** Short form to generate definition. */
- public Column(String name, int type)
- {
- this.name = name;
- this.type = type;
- }
-
- /** Longer form for character types. */
- public Column(String name, int type, int length)
- {
- this.name = name;
- this.type = type;
- this.length = length;
- }
-
- /** Full form for definitions. */
- public Column(String name, int type, int length, int precision,
- boolean isPrimaryKey, boolean isAutoIncrement)
- {
- this.name = name;
- this.type = type;
- this.length = length;
- this.precision = precision;
- this.isPrimaryKey = isPrimaryKey;
- this.isAutoIncrement = isAutoIncrement;
- }
-
- /** Returns true if this is an autoincrement column. */
- public boolean isAutoIncrement()
- {
- return isAutoIncrement;
- }
-
- /** Sets the column to be autoincrement. */
- public void setAutoIncrement(boolean isAutoIncrement)
- {
- this.isAutoIncrement = isAutoIncrement;
- }
-
- /** Returns true if this column is a primary key. */
- public boolean isPrimaryKey()
- {
- return isPrimaryKey;
- }
-
- /** Sets the primary key (true if primary). */
- public void setPrimaryKey(boolean isPrimaryKey)
- {
- this.isPrimaryKey = isPrimaryKey;
- }
-
- /** Returns the length of this column. */
- public int getLength()
- {
- return length;
- }
-
- /** Sets the length of the column or -1 if not used. */
- public void setLength(int length)
- {
- this.length = length;
- }
-
- /** Returns the column name. */
- public String getName()
- {
- return name;
- }
-
- /** Sets the column name. */
- public void setName(String name)
- {
- this.name = name;
- }
-
- /** Returns the column precision. */
- public int getPrecision()
- {
- return precision;
- }
-
- /** Sets the precision of this column or -1 if not used. */
- public void setPrecision(int precision)
- {
- this.precision = precision;
- }
-
- /** Returns the column type. */
- public int getType()
- {
- return type;
- }
-
- /** Sets the column type, which must be a value from java.sql.Type. */
- public void setType(int type)
- {
- this.type = type;
- }
-
- /** Returns true if this column has an index. */
- public boolean isIndexed()
- {
- return indexed;
- }
-
- /** Set property to true to add an extra index on this column. */
- public void setIndexed(boolean indexed)
- {
- this.indexed = indexed;
- }
-
- @Override public String toString()
- {
- return ToStringHelper.toString(this);
- }
+ private String name;
+ private int type;
+ private int length;
+ private int precision;
+ private boolean isPrimaryKey;
+ private boolean isAutoIncrement;
+ private boolean indexed;
+
+ /** Instantiate empty column to be filled out by accessors. */
+ public Column()
+ {
+ }
+
+ /** Short form to generate definition. */
+ public Column(String name, int type)
+ {
+ this.name = name;
+ this.type = type;
+ }
+
+ /** Longer form for character types. */
+ public Column(String name, int type, int length)
+ {
+ this.name = name;
+ this.type = type;
+ this.length = length;
+ }
+
+ /** Full form for definitions. */
+ public Column(String name, int type, int length, int precision,
+ boolean isPrimaryKey, boolean isAutoIncrement)
+ {
+ this.name = name;
+ this.type = type;
+ this.length = length;
+ this.precision = precision;
+ this.isPrimaryKey = isPrimaryKey;
+ this.isAutoIncrement = isAutoIncrement;
+ }
+
+ /** Returns true if this is an autoincrement column. */
+ public boolean isAutoIncrement()
+ {
+ return isAutoIncrement;
+ }
+
+ /** Sets the column to be autoincrement. */
+ public void setAutoIncrement(boolean isAutoIncrement)
+ {
+ this.isAutoIncrement = isAutoIncrement;
+ }
+
+ /** Returns true if this column is a primary key. */
+ public boolean isPrimaryKey()
+ {
+ return isPrimaryKey;
+ }
+
+ /** Sets the primary key (true if primary). */
+ public void setPrimaryKey(boolean isPrimaryKey)
+ {
+ this.isPrimaryKey = isPrimaryKey;
+ }
+
+ /** Returns the length of this column. */
+ public int getLength()
+ {
+ return length;
+ }
+
+ /** Sets the length of the column or -1 if not used. */
+ public void setLength(int length)
+ {
+ this.length = length;
+ }
+
+ /** Returns the column name. */
+ public String getName()
+ {
+ return name;
+ }
+
+ /** Sets the column name. */
+ public void setName(String name)
+ {
+ this.name = name;
+ }
+
+ /** Returns the column precision. */
+ public int getPrecision()
+ {
+ return precision;
+ }
+
+ /** Sets the precision of this column or -1 if not used. */
+ public void setPrecision(int precision)
+ {
+ this.precision = precision;
+ }
+
+ /** Returns the column type. */
+ public int getType()
+ {
+ return type;
+ }
+
+ /** Sets the column type, which must be a value from java.sql.Type. */
+ public void setType(int type)
+ {
+ this.type = type;
+ }
+
+ /** Returns true if this column has an index. */
+ public boolean isIndexed()
+ {
+ return indexed;
+ }
+
+ /** Set property to true to add an extra index on this column. */
+ public void setIndexed(boolean indexed)
+ {
+ this.indexed = indexed;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString()
+ {
+ return ToStringHelper.toString(this);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see java.lang.Object#clone()
+ */
+ public Column clone()
+ {
+ Column newCol = new Column();
+ newCol.setName(name);
+ newCol.setType(type);
+ newCol.setLength(length);
+ newCol.setPrecision(precision);
+ newCol.setPrimaryKey(isPrimaryKey);
+ newCol.setAutoIncrement(isAutoIncrement);
+ newCol.setIndexed(indexed);
+ return newCol;
+ }
}
Oops, something went wrong.

0 comments on commit 3b7b16a

Please sign in to comment.