public class NormalizeNameComponent extends AbstractLogEnabled implements Component, Contextualizable
Modifier and Type | Field and Description |
---|---|
protected Context |
_context
The avalon context.
|
static String |
ROLE
The component role
|
Constructor and Description |
---|
NormalizeNameComponent() |
Modifier and Type | Method and Description |
---|---|
private int |
_getCountSameValue(String value,
Map<String,String> mappingTable,
int count) |
void |
contextualize(Context context) |
protected String |
escapeValue(String value,
Connection connection)
Escape column value or comment
|
protected Map<String,HashMap<String,String>> |
getMappingTableColumnNameFromCache()
Get the column name from the cache
|
protected Map<String,String> |
getMappingTableNameFromCache()
Get the table name from the cache
|
protected String |
normalizedColumnName(String mappingPolicy,
String initialColumnName,
String initialTableName,
Map<String,Map<String,String>> reservedWords,
Connection connection)
Get the normalized column name
|
protected String |
normalizedComment(String initialComment,
int maxLength,
Connection connection)
Get the normalized comment
|
protected String |
normalizedTableName(String prefix,
String mappingPolicy,
String initialTableName,
Connection connection)
Get the normalized table name
|
protected String |
normalizeNameFromPolicy(String mappingPolicy,
String initialName)
Normalize the initialName into a name depends on the mapping Policy
|
getLogger, setLogger
public NormalizeNameComponent()
public void contextualize(Context context) throws ContextException
contextualize
in interface Contextualizable
ContextException
protected String normalizedTableName(String prefix, String mappingPolicy, String initialTableName, Connection connection) throws ContextException
prefix
- the table name prefixmappingPolicy
- the mapping policyinitialTableName
- The initial table nameconnection
- the connectionContextException
- context exceptionprotected String normalizedColumnName(String mappingPolicy, String initialColumnName, String initialTableName, Map<String,Map<String,String>> reservedWords, Connection connection) throws ContextException
mappingPolicy
- the mappingPolicyinitialColumnName
- The initial column nameinitialTableName
- The initial table namereservedWords
- the map of reserved wordsconnection
- the connectionContextException
- context exceptionprivate int _getCountSameValue(String value, Map<String,String> mappingTable, int count)
protected String normalizedComment(String initialComment, int maxLength, Connection connection)
initialComment
- the initial commentmaxLength
- The maximun number of authorized charactersconnection
- the connectionprotected String escapeValue(String value, Connection connection)
value
- The value or SQL commentconnection
- the connectionprotected Map<String,String> getMappingTableNameFromCache() throws ContextException
ContextException
- context exceptionprotected Map<String,HashMap<String,String>> getMappingTableColumnNameFromCache() throws ContextException
ContextException
- context exceptionprotected String normalizeNameFromPolicy(String mappingPolicy, String initialName)
mappingPolicy
- (FULL, CAMELCASE, FIRSTCHAR)initialName
- the initial table name