com.im.df/1 5.8

com.im.df.util
Class DBNameUtils.DefaultValidator

java.lang.Object
  extended by com.im.df.util.DBNameUtils.DefaultValidator
All Implemented Interfaces:
DBNameUtils.Validator
Enclosing class:
DBNameUtils

public static class DBNameUtils.DefaultValidator
extends Object
implements DBNameUtils.Validator

Default validator for the basic validation of DB a DFItem names


Constructor Summary
DBNameUtils.DefaultValidator(DBNameUtils.VType type)
          Creates default validator
DBNameUtils.DefaultValidator(DBNameUtils.VType type, DFContainer parentContainer)
          Creates default validator
DBNameUtils.DefaultValidator(DBNameUtils.VType type, DFContainer parentContainer, String ownCurrentName)
          Creates default validator
DBNameUtils.DefaultValidator(DBNameUtils.VType type, int maxLength)
          Creates default validator
DBNameUtils.DefaultValidator(DBNameUtils.VType type, String[] usedNames)
          Creates default validator
DBNameUtils.DefaultValidator(DBNameUtils.VType type, String[] usedNames, boolean usedNamesCaseSensitive)
          Creates default validator
DBNameUtils.DefaultValidator(DBNameUtils.VType type, String[] usedNames, boolean usedNamesCaseSensitive, int maxLength)
          Creates default validator
DBNameUtils.DefaultValidator(DBNameUtils.VType type, String[] usedNames, int maxLength)
          Creates default validator
 
Method Summary
static DBNameUtils.DefaultValidator forItem(DFItem item)
           
 int getMaxLength()
          Get maximum possible dbNames length.
 boolean isMustExist()
           
 SchemaQualifiedName normalizeName(SchemaQualifiedName dbName)
           
 String normalizeName(String dbName)
          Return acceptable db name
protected  String normalizeName(String dbName, boolean doValidation)
           
 void setMaxLength(int maxLength)
          Set maximum possible dbNames length.
 void setMustExist(boolean mustExist)
           
 String validate(String name)
          Validate the name.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DBNameUtils.DefaultValidator

public DBNameUtils.DefaultValidator(DBNameUtils.VType type)
Creates default validator

Parameters:
type - Type of the validator - because of proper error messages

DBNameUtils.DefaultValidator

public DBNameUtils.DefaultValidator(DBNameUtils.VType type,
                                    int maxLength)
Creates default validator

Parameters:
type - Type of the validator - because of proper error messages
maxLength - Maximum name length

DBNameUtils.DefaultValidator

public DBNameUtils.DefaultValidator(DBNameUtils.VType type,
                                    DFContainer parentContainer)
Creates default validator

Parameters:
type - Type of the validator - because of proper error messages
parentContainer - Is used for getting the existing DFitems names.

DBNameUtils.DefaultValidator

public DBNameUtils.DefaultValidator(DBNameUtils.VType type,
                                    DFContainer parentContainer,
                                    String ownCurrentName)
Creates default validator

Parameters:
type - Type of the validator - because of proper error messages
parentContainer - Is used for getting the existing DFitems names.
ownCurrentName - Current name of the item (will be accepted as correct)

DBNameUtils.DefaultValidator

public DBNameUtils.DefaultValidator(DBNameUtils.VType type,
                                    String[] usedNames)
Creates default validator

Parameters:
type - Type of the validator - because of proper error messages
usedNames - This array can be used for extending the basic validation - Validator then also prevent using the name of existing element (column, table,...)

DBNameUtils.DefaultValidator

public DBNameUtils.DefaultValidator(DBNameUtils.VType type,
                                    String[] usedNames,
                                    boolean usedNamesCaseSensitive)
Creates default validator

Parameters:
type - Type of the validator - because of proper error messages
usedNames - This array can be used for extending the basic validation - Validator then also prevent using the name of existing element (column, table,...)
usedNamesCaseSensitive - The used names are case sensitive?

DBNameUtils.DefaultValidator

public DBNameUtils.DefaultValidator(DBNameUtils.VType type,
                                    String[] usedNames,
                                    int maxLength)
Creates default validator

Parameters:
type - Type of the validator - because of proper error messages
usedNames - This array can be used for extending the basic validation - Validator then also prevent using the name of existing element (column, table,...)
maxLength - Maximum name length

DBNameUtils.DefaultValidator

public DBNameUtils.DefaultValidator(DBNameUtils.VType type,
                                    String[] usedNames,
                                    boolean usedNamesCaseSensitive,
                                    int maxLength)
Creates default validator

Parameters:
type - Type of the validator - because of proper error messages
usedNames - This array can be used for extending the basic validation - Validator then also prevent using the name of existing element (column, table,...)
usedNamesCaseSensitive - The used names are case sensitive?
maxLength - Maximum name length
Method Detail

forItem

public static DBNameUtils.DefaultValidator forItem(DFItem item)

setMustExist

public void setMustExist(boolean mustExist)

isMustExist

public boolean isMustExist()

getMaxLength

public int getMaxLength()
Get maximum possible dbNames length.


setMaxLength

public void setMaxLength(int maxLength)
Set maximum possible dbNames length.

Parameters:
maxLength - The maximum length for the column/table/... name

validate

public String validate(String name)
Description copied from interface: DBNameUtils.Validator
Validate the name.

Specified by:
validate in interface DBNameUtils.Validator
Returns:
The error message or null if name is correct

normalizeName

public String normalizeName(String dbName)
Description copied from interface: DBNameUtils.Validator
Return acceptable db name

Specified by:
normalizeName in interface DBNameUtils.Validator

normalizeName

public SchemaQualifiedName normalizeName(SchemaQualifiedName dbName)
Specified by:
normalizeName in interface DBNameUtils.Validator

normalizeName

protected String normalizeName(String dbName,
                               boolean doValidation)

com.im.df/1 5.8