protected String buildUniqueKeyConstraintName(String tableName,int serialNumber,int maximumNameLength){
  String uniqueKeyName="UNQ_" + tableName + "_"+ serialNumber;
  if (uniqueKeyName.length() > maximumNameLength) {
    uniqueKeyName=tableName + serialNumber;
    if (uniqueKeyName.length() > maximumNameLength) {
      uniqueKeyName=Helper.removeAllButAlphaNumericToFit(tableName + serialNumber,maximumNameLength);
      if (uniqueKeyName.length() > maximumNameLength) {
        String onlyAlphaNumericTableName=Helper.removeAllButAlphaNumericToFit(tableName,0);
        String serialName=String.valueOf(serialNumber);
        uniqueKeyName=Helper.shortenStringsByRemovingVowelsToFit(onlyAlphaNumericTableName,serialName,maximumNameLength);
        if (uniqueKeyName.length() > maximumNameLength) {
          String shortenedTableName=Helper.removeVowels(onlyAlphaNumericTableName);
          uniqueKeyName=Helper.truncate(shortenedTableName,maximumNameLength - serialName.length()) + serialName;
        }
      }
    }
  }
  return uniqueKeyName;
}

protected String buildUniqueKeyConstraintName ( String tableName , int serialNumber , int maximumNameLength ) { String uniqueKeyName = "UNQ_" + tableName + "_" + serialNumber ; if ( uniqueKeyName . length ( ) > maximumNameLength ) { uniqueKeyName = tableName + serialNumber ; if ( uniqueKeyName . length ( ) > maximumNameLength ) { uniqueKeyName = Helper . removeAllButAlphaNumericToFit ( tableName + serialNumber , maximumNameLength ) ; if ( uniqueKeyName . length ( ) > maximumNameLength ) { String onlyAlphaNumericTableName = Helper . removeAllButAlphaNumericToFit ( tableName , 0 ) ; String serialName = String . valueOf ( serialNumber ) ; uniqueKeyName = Helper . shortenStringsByRemovingVowelsToFit ( onlyAlphaNumericTableName , serialName , maximumNameLength ) ; if ( uniqueKeyName . length ( ) > maximumNameLength ) { String shortenedTableName = Helper . removeVowels ( onlyAlphaNumericTableName ) ; uniqueKeyName = Helper . truncate ( shortenedTableName , maximumNameLength - serialName . length ( ) ) + serialName ; } } } } return uniqueKeyName ; }
return unique key constraint name built from the table name and sequence number with the specified maximum length . to make the name short enough we 1 . drop the " unq_ " prefix . 2 . drop the underscore characters if any . 3 . drop the vowels from the table name . 4 . truncate the table name to zero length if necessary .
