org.eclipse.datatools.enablement.sybase.asa.schemaobjecteditor.examples.utils
Class ASADataValidator

java.lang.Object
  extended by org.eclipse.datatools.enablement.sybase.asa.schemaobjecteditor.examples.utils.AbstractSqlDataValidator
      extended by org.eclipse.datatools.enablement.sybase.asa.schemaobjecteditor.examples.utils.ASADataValidator
All Implemented Interfaces:
ISqlDataValidatorAssistant, org.eclipse.datatools.sqltools.core.ISqlDataValidator

public class ASADataValidator
extends AbstractSqlDataValidator

Author:
Shifeng Yu

Field Summary
 
Fields inherited from interface org.eclipse.datatools.sqltools.core.ISqlDataValidator
CONVERT_FAIL, SYS_ERROR, VALIDATE_FAIL_CONVERT_SUCCESS, VALIDATE_SUCCESS
 
Constructor Summary
ASADataValidator(org.eclipse.datatools.sqltools.core.DatabaseIdentifier databaseIdentifier)
           
 
Method Summary
 java.lang.Object convert(java.lang.String dataType, java.lang.String inputValue, java.lang.String profileName, java.lang.String dbName)
           
static boolean isTypeWithoutWS(java.lang.String typeName)
          Whether the data type has not scale and precision.
static boolean isTypeWithWS(java.lang.String typeName)
          Whether the data type has scale and precision.
static boolean needQuote(java.lang.String dataType)
          This method is used to judge whether user's input need quote before do validation.
 int validate(IDatatype dataType, java.lang.String inputValue)
           
 int validate(java.lang.String dataType, java.lang.String inputValue)
          Here we use the select convert method to validate the inputValue.
 
Methods inherited from class org.eclipse.datatools.enablement.sybase.asa.schemaobjecteditor.examples.utils.AbstractSqlDataValidator
getConvertedValue, getErrorMessage, getStatus, isNeedSupportExpression, setNeedSupportExpression
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ASADataValidator

public ASADataValidator(org.eclipse.datatools.sqltools.core.DatabaseIdentifier databaseIdentifier)
Parameters:
profileName -
Method Detail

isTypeWithoutWS

public static boolean isTypeWithoutWS(java.lang.String typeName)
Whether the data type has not scale and precision. For example, NUMERIC has scale and precision and INT has not.

Parameters:
typeName -
Returns:

isTypeWithWS

public static boolean isTypeWithWS(java.lang.String typeName)
Whether the data type has scale and precision. For example, NUMERIC has scale and precision and INT has not.

Parameters:
typeName -
Returns:

validate

public int validate(java.lang.String dataType,
                    java.lang.String inputValue)
Here we use the select convert method to validate the inputValue. If the inputValue passes the convert operation (including truncated case), we show the converted value to user. Otherwise, we will get an error and show error message to user and force user to reedit his input.


validate

public int validate(IDatatype dataType,
                    java.lang.String inputValue)

needQuote

public static boolean needQuote(java.lang.String dataType)
This method is used to judge whether user's input need quote before do validation.

Parameters:
dataType -
Returns:

convert

public java.lang.Object convert(java.lang.String dataType,
                                java.lang.String inputValue,
                                java.lang.String profileName,
                                java.lang.String dbName)
                         throws java.lang.Exception
Throws:
java.lang.Exception