org.eclipse.datatools.enablement.sybase.asa.schemaobjecteditor.examples.tableeditor.utils
Class ConstraintCreationUtils

java.lang.Object
  extended by org.eclipse.datatools.enablement.sybase.asa.schemaobjecteditor.examples.tableeditor.utils.ConstraintCreationUtils
All Implemented Interfaces:
IConstraintCreationConstants

public class ConstraintCreationUtils
extends java.lang.Object
implements IConstraintCreationConstants

Author:
David Cui

Field Summary
 
Fields inherited from interface org.eclipse.datatools.enablement.sybase.asa.schemaobjecteditor.examples.tableeditor.utils.IConstraintCreationConstants
CHECK, COLS_CHK_POSTFIX, COMMA, DATA_TYPE_LONG_VARCHAR, EMPTY_STRING, FALSE, IS_PART_OF_PRIMARYKEY, LEFT_PARENTHESIS, PRIMARYKEY_COL_INDEX, RIGHT_PARENTHESIS, SAVE_FILE_POSTFIX, SINGLE_QUOTE, SPACE, TABLE_INSTANCE, THREE_TABS, TRUE, ZERO
 
Constructor Summary
ConstraintCreationUtils()
           
 
Method Summary
static boolean canTwoColumnsMap(Column firstCol, Column secondCol)
          Judge whether two columns can map to create foreign key.
static Column getColumnByName(Table table, java.lang.String columnName)
          Get the column according to the given name
static Column getColumnByName(UniqueConstraint constraint, java.lang.String columnName)
          Get the column according to the given name
static DatabaseDefinition getDatabaseDefinition(Table table)
          Get DatabaseDefinition by a given table
static java.lang.String getDataTypeFullFormatString(Column column)
           
static ValidatorMessage getValidatorMessage(org.eclipse.datatools.sqltools.core.DatabaseIdentifier databaseIdentifier, Table table, java.lang.String objectName)
          Get the validator message of a given object name
static boolean isNothing(java.lang.String str)
          If a string is null or its length is 0, return true, else return false.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConstraintCreationUtils

public ConstraintCreationUtils()
Method Detail

getDataTypeFullFormatString

public static java.lang.String getDataTypeFullFormatString(Column column)

getColumnByName

public static Column getColumnByName(Table table,
                                     java.lang.String columnName)
Get the column according to the given name

Parameters:
table -
columnName -
Returns:

getColumnByName

public static Column getColumnByName(UniqueConstraint constraint,
                                     java.lang.String columnName)
Get the column according to the given name

Parameters:
constraint -
columnName -
Returns:

canTwoColumnsMap

public static boolean canTwoColumnsMap(Column firstCol,
                                       Column secondCol)
Judge whether two columns can map to create foreign key. Here there is particular case. It is mainly focus on the data types of sysname and longsysname in ASE. Columns with datatype of sysname could map to columns with char or varchar datatype whose length is 30. And Columns with datatype of longsysname could map to columns with char or varchar datatype whose length is 255. In the model configuration, We set sysname and longsyanme's properties that lengthSupport to be 'false' in order to get a right display for them, and defaultLength to be '30' and '255'. As so trick the model and get the defaultLength to map with a character datatype.

Parameters:
firstCol -
secondCol -
Returns:

getDatabaseDefinition

public static DatabaseDefinition getDatabaseDefinition(Table table)
Get DatabaseDefinition by a given table

Parameters:
table -
Returns:

isNothing

public static boolean isNothing(java.lang.String str)
If a string is null or its length is 0, return true, else return false.

Parameters:
str -
Returns:

getValidatorMessage

public static ValidatorMessage getValidatorMessage(org.eclipse.datatools.sqltools.core.DatabaseIdentifier databaseIdentifier,
                                                   Table table,
                                                   java.lang.String objectName)
Get the validator message of a given object name

Parameters:
databaseIdentifier -
table -
objectName -
Returns: