com.im.df/1 5.8

com.im.df.util
Class DBNameUtils

java.lang.Object
  extended by com.im.df.util.DBNameUtils

public class DBNameUtils
extends Object

Utilities for names used in Databases - column, table names, etc. It can be user for validation as well as for normalizing the given name ( making it acceptable)


Nested Class Summary
static class DBNameUtils.DefaultValidator
          Default validator for the basic validation of DB a DFItem names
static interface DBNameUtils.Validator
          Should be used for validation the DB names (columns, tables, etc.)
static class DBNameUtils.VType
          Types of default validator.
 
Field Summary
static int MAX_DB_IDENTIFIER_LENGTH
          The default maximum identifier name.
static int MAX_DFITEM_ITEM_NAME_LENGTH
          The default maximum identifier name
static DBNameUtils.Validator VALIDATOR_ACCEPTING_ALL
          This is dummy implementation which accepts all strings
 
Constructor Summary
DBNameUtils()
           
 
Method Summary
static DBNameUtils.DefaultValidator createDefaultValidatorForLists(DFContainer<DFList> parentContainer, DFField field)
           
static Pattern createPatternFor(String[] words, boolean caseSensitive)
           
static String[] getColumnNamesFor(DBTableInfo info, String[] exceptThese)
           
static String getNameWithNextNumber(String name, char numberSeparator, int maxLength)
           
static boolean isCorrectFormatName(String dbName)
           
static boolean isSQLReservedWord(String dbName)
           
static String removeAccents(String text)
          Replace chars with accent if possible.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAX_DB_IDENTIFIER_LENGTH

public static final int MAX_DB_IDENTIFIER_LENGTH
The default maximum identifier name. In most cases validator uses platform specific maximum length (given by DBDatabaseInfo.getMaxXXX() methods). If database is not known then this value is used. It can be changed in the future. We should keep it as minimum from all supported databases to be sure that validated identifier will be OK on all DBs.


MAX_DFITEM_ITEM_NAME_LENGTH

public static final int MAX_DFITEM_ITEM_NAME_LENGTH
The default maximum identifier name

See Also:
Constant Field Values

VALIDATOR_ACCEPTING_ALL

public static final DBNameUtils.Validator VALIDATOR_ACCEPTING_ALL
This is dummy implementation which accepts all strings

Constructor Detail

DBNameUtils

public DBNameUtils()
Method Detail

createDefaultValidatorForLists

public static DBNameUtils.DefaultValidator createDefaultValidatorForLists(DFContainer<DFList> parentContainer,
                                                                          DFField field)

removeAccents

public static String removeAccents(String text)
Replace chars with accent if possible.

Parameters:
text - The text that needs to be normalized
Returns:
The normalized text

isCorrectFormatName

public static boolean isCorrectFormatName(String dbName)

isSQLReservedWord

public static boolean isSQLReservedWord(String dbName)
Returns:
True if the given word is SQL reserved word (case insensitive)

getColumnNamesFor

public static String[] getColumnNamesFor(DBTableInfo info,
                                         String[] exceptThese)

getNameWithNextNumber

public static String getNameWithNextNumber(String name,
                                           char numberSeparator,
                                           int maxLength)

createPatternFor

public static Pattern createPatternFor(String[] words,
                                       boolean caseSensitive)

com.im.df/1 5.8