Project Wonder 5.0

er.extensions.migration
Class ERXMigrationColumn

java.lang.Object
  extended by er.extensions.migration.ERXMigrationColumn

public class ERXMigrationColumn
extends java.lang.Object

ERXMigrationColumn is conceptually equivalent to an EOAttribute in the ERXMigrationXxx model. To obtain an ERXMigrationColumn, call ERXMigrationTable.newXxxColumn(..).

Author:
mschrag

Nested Class Summary
static class ERXMigrationColumn._ColumnType
          Implements EOSchemaSynchronization.ColumnTypes
 
Field Summary
static boolean AllowsNull
          Constant for use with ERXMigrationTable.newXxxColumn AllowsNull columns.
static boolean NotNull
          Constant for use with ERXMigrationTable.newXxxColumn NotNull columns.
static java.lang.String NULL_VALUE_TYPE
           
 
Constructor Summary
protected ERXMigrationColumn(ERXMigrationTable table, java.lang.String name, int jdbcType, int width, int precision, int scale, boolean allowsNull, java.lang.String overrideValueType, java.lang.Object defaultValue)
          Constructs a new ERXMigrationColumn.
 
Method Summary
 com.webobjects.foundation.NSArray<com.webobjects.eoaccess.EOSQLExpression> _createExpressions()
          Returns an array of EOSQLExpressions for creating this column.
 com.webobjects.foundation.NSArray<com.webobjects.eoaccess.EOSQLExpression> _deleteExpressions()
          Returns an array of EOSQLExpressions for deleting this column.
 com.webobjects.eoaccess.EOAttribute _newAttribute()
          Returns an EOAttribute with all of its fields filled in based on the properties of this ERXMigrationColumn.
 com.webobjects.eoaccess.EOAttribute _newAttribute(com.webobjects.eoaccess.EOEntity entity)
          Returns an EOAttribute with all of its fields filled in based on the properties of this ERXMigrationColumn.
 com.webobjects.foundation.NSArray<com.webobjects.eoaccess.EOSQLExpression> _renameToExpressions(java.lang.String newName)
          Returns an array of EOSQLExpressions for renaming this column.
 void _setAllowsNull(boolean allowsNull)
          Sets whether or not this column allows nulls.
 void _setForeignKeyDestination(ERXMigrationColumn foreignKeyDestination)
          Sets the destination column for this foreign key.
 void _setName(java.lang.String name)
          Sets the name of this column.
 void _setNew(boolean isNew)
          Sets whether or not this column has been created in the database.
 void _setOverrideExternalType(java.lang.String overrideExternalType)
          Overrides the external type of this column.
 void _setOverrideValueType(java.lang.String overrideValueType)
          Sets the value type for the underlying attribute for this column.
 void _setPrecision(int precision)
          Sets the precision of this column.
 void _setPrimaryKey(boolean primaryKey)
          Sets whether or not this column is a primary key.
 void _setScale(int scale)
          Sets the scale of this column.
 void _setWidth(int width)
          Sets the width of this column.
 boolean allowsNull()
          Returns the width of this column.
 void create()
          Executes the SQL operations to create this column.
 java.lang.Object defaultValue()
          Returns the default value of this column.
 void delete()
          Executes the SQL operations to delete this column.
 ERXMigrationColumn foreignKeyDestination()
          Returns the destination column for this foreign key (note this is only valid if you told migrations the foreign key).
 boolean isNew()
          Returns true if this column has not yet been created in the database.
 boolean isPrimaryKey()
          Returns whether or not this column is a primary key (note this is only valid if you told migrations that this column is a primary key).
 java.lang.String name()
          Returns the name of this column.
 java.lang.String overrideExternalType()
          Returns the external type of this column (or null if there is no override).
 java.lang.String overrideValueType()
          Returns the value type associated with the underlying attribute (or null to have this autoselected).
 int precision()
          Returns the precision of this column.
 void renameTo(java.lang.String newName)
          Executes the SQL operations to rename this column.
 int scale()
          Returns the scale of this column.
 void setAllowsNull(boolean allowsNull)
          Changes the "allows null" state of this column.
 void setDataType(int jdbcType, int scale, int precision, int width, com.webobjects.foundation.NSDictionary options)
          Changes the data type of this column.
 void setDefaultValue(java.lang.Object defaultValue)
          Sets the default value of this column.
 void setNumericType(int jdbcType, int scale, int precision, com.webobjects.foundation.NSDictionary options)
          Changes the data type of this column to a new numeric type.
 void setWidthType(int jdbcType, int width, com.webobjects.foundation.NSDictionary options)
          Changes the data type of this column to a type that has a width.
 ERXMigrationTable table()
          Returns the parent ERXMigrationTable of this column.
 int width()
          Returns the width of this column.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NULL_VALUE_TYPE

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

AllowsNull

public static final boolean AllowsNull
Constant for use with ERXMigrationTable.newXxxColumn AllowsNull columns.

See Also:
Constant Field Values

NotNull

public static final boolean NotNull
Constant for use with ERXMigrationTable.newXxxColumn NotNull columns.

See Also:
Constant Field Values
Constructor Detail

ERXMigrationColumn

protected ERXMigrationColumn(ERXMigrationTable table,
                             java.lang.String name,
                             int jdbcType,
                             int width,
                             int precision,
                             int scale,
                             boolean allowsNull,
                             java.lang.String overrideValueType,
                             java.lang.Object defaultValue)
Constructs a new ERXMigrationColumn.

Parameters:
table - the parent table
name - the name of the column to create
jdbcType - the JDBC type of the column (see java.sql.Types)
width - the width of the column (or 0 for unspecified)
precision - the precision of the column (or 0 for unspecified)
scale - the scale of the column (or 0 for unspecified)
allowsNull - if true, the column will allow null values
defaultValue - this will set the "Default" hint in the EOAttribute's userInfo dictionary (your plugin must support this)
Method Detail

table

public ERXMigrationTable table()
Returns the parent ERXMigrationTable of this column.

Returns:
the parent ERXMigrationTable of this column

_setName

public void _setName(java.lang.String name)
Sets the name of this column. This does not perform a column rename operation.

Parameters:
name - the name of this column

name

public java.lang.String name()
Returns the name of this column.

Returns:
the name of this column

_setWidth

public void _setWidth(int width)
Sets the width of this column. This does not perform a column resize operation.

Parameters:
width - the width of this column

width

public int width()
Returns the width of this column.

Returns:
the width of this column

_setAllowsNull

public void _setAllowsNull(boolean allowsNull)
Sets whether or not this column allows nulls. This does not perform a column change operation.

Parameters:
allowsNull - if true, this column allows nulls

allowsNull

public boolean allowsNull()
Returns the width of this column.

Returns:
the width of this column

_setPrecision

public void _setPrecision(int precision)
Sets the precision of this column. This does not perform a column change operation.

Parameters:
precision - the precision of this column

precision

public int precision()
Returns the precision of this column.

Returns:
the precision of this column

_setScale

public void _setScale(int scale)
Sets the scale of this column. This does not perform a column change operation.

Parameters:
scale - the scale of this column

scale

public int scale()
Returns the scale of this column.

Returns:
the scale of this column

_setOverrideExternalType

public void _setOverrideExternalType(java.lang.String overrideExternalType)
Overrides the external type of this column.

Parameters:
overrideExternalType - the external type to override

overrideExternalType

public java.lang.String overrideExternalType()
Returns the external type of this column (or null if there is no override).

Returns:
the external type of this column

_setOverrideValueType

public void _setOverrideValueType(java.lang.String overrideValueType)
Sets the value type for the underlying attribute for this column.

Parameters:
overrideValueType - the value type for the underlying attribute for this column

overrideValueType

public java.lang.String overrideValueType()
Returns the value type associated with the underlying attribute (or null to have this autoselected).

Returns:
the value type associated with the underlying attribute

setDefaultValue

public void setDefaultValue(java.lang.Object defaultValue)
Sets the default value of this column.

Parameters:
defaultValue - the default value of this column

defaultValue

public java.lang.Object defaultValue()
Returns the default value of this column.

Returns:
the default value of this column

_setPrimaryKey

public void _setPrimaryKey(boolean primaryKey)
Sets whether or not this column is a primary key.

Parameters:
primaryKey - whether or not this column is a primary key

isPrimaryKey

public boolean isPrimaryKey()
Returns whether or not this column is a primary key (note this is only valid if you told migrations that this column is a primary key).

Returns:
whether or not this column is a primary key

_setForeignKeyDestination

public void _setForeignKeyDestination(ERXMigrationColumn foreignKeyDestination)
Sets the destination column for this foreign key.

Parameters:
foreignKeyDestination - the destination column for this foreign key

foreignKeyDestination

public ERXMigrationColumn foreignKeyDestination()
Returns the destination column for this foreign key (note this is only valid if you told migrations the foreign key).

Returns:
the destination column for this foreign key

isNew

public boolean isNew()
Returns true if this column has not yet been created in the database.

Returns:
if this column has not yet been created in the database

_setNew

public void _setNew(boolean isNew)
Sets whether or not this column has been created in the database.

Parameters:
isNew - if true, the column has been created

_newAttribute

public com.webobjects.eoaccess.EOAttribute _newAttribute()
Returns an EOAttribute with all of its fields filled in based on the properties of this ERXMigrationColumn. The attribute is attached to a table._blankEntity().

Returns:
an EOAttribute with all of its fields filled in

_newAttribute

public com.webobjects.eoaccess.EOAttribute _newAttribute(com.webobjects.eoaccess.EOEntity entity)
Returns an EOAttribute with all of its fields filled in based on the properties of this ERXMigrationColumn. The attribute is attached to the given entity.

Parameters:
entity - the entity to add the attribute to
Returns:
an EOAttribute with all of its fields filled in

_createExpressions

public com.webobjects.foundation.NSArray<com.webobjects.eoaccess.EOSQLExpression> _createExpressions()
Returns an array of EOSQLExpressions for creating this column.

Returns:
an array of EOSQLExpressions for creating this column

create

public void create()
            throws java.sql.SQLException
Executes the SQL operations to create this column.

Throws:
java.sql.SQLException - if the creation fails

_deleteExpressions

public com.webobjects.foundation.NSArray<com.webobjects.eoaccess.EOSQLExpression> _deleteExpressions()
Returns an array of EOSQLExpressions for deleting this column.

Returns:
an array of EOSQLExpressions for deleting this column

delete

public void delete()
            throws java.sql.SQLException
Executes the SQL operations to delete this column.

Throws:
java.sql.SQLException - if the delete fails

_renameToExpressions

public com.webobjects.foundation.NSArray<com.webobjects.eoaccess.EOSQLExpression> _renameToExpressions(java.lang.String newName)
Returns an array of EOSQLExpressions for renaming this column.

Parameters:
newName - the new name of this column
Returns:
an array of EOSQLExpressions for renaming this column

renameTo

public void renameTo(java.lang.String newName)
              throws java.sql.SQLException
Executes the SQL operations to rename this column.

Parameters:
newName - the new name of this column
Throws:
java.sql.SQLException - if the rename fails

setAllowsNull

public void setAllowsNull(boolean allowsNull)
                   throws java.sql.SQLException
Changes the "allows null" state of this column.

Parameters:
allowsNull - if true, this column allows nulls
Throws:
java.sql.SQLException - if the change fails

setDataType

public void setDataType(int jdbcType,
                        int scale,
                        int precision,
                        int width,
                        com.webobjects.foundation.NSDictionary options)
                 throws java.sql.SQLException
Changes the data type of this column.

Parameters:
jdbcType - the new JDBC type of the column (see java.sql.Types)
scale - the new scale
precision - the new precision
width - the new width
options - the options to use for conversion (or null)
Throws:
java.sql.SQLException - if the change fails

setWidthType

public void setWidthType(int jdbcType,
                         int width,
                         com.webobjects.foundation.NSDictionary options)
                  throws java.sql.SQLException
Changes the data type of this column to a type that has a width.

Parameters:
jdbcType - the new JDBC type of the column (see java.sql.Types)
width - the new width
options - the options to use for conversion (or null)
Throws:
java.sql.SQLException - if the change fails

setNumericType

public void setNumericType(int jdbcType,
                           int scale,
                           int precision,
                           com.webobjects.foundation.NSDictionary options)
                    throws java.sql.SQLException
Changes the data type of this column to a new numeric type.

Parameters:
jdbcType - the new JDBC type of the column (see java.sql.Types)
scale - the new scale
precision - the new precision
options - the options to use for conversion (or null)
Throws:
java.sql.SQLException - if the change fails

Last updated: Tue, Feb 21, 2017 • 05:45 PM CET

Copyright © 2002 – 2007 Project Wonder.