Class NormalizeNameComponent
- java.lang.Object
-
- org.ametys.runtime.plugin.component.AbstractLogEnabled
-
- org.ametys.plugins.contentio.export.sql.NormalizeNameComponent
-
- All Implemented Interfaces:
LogEnabled
,Component
,Contextualizable
public class NormalizeNameComponent extends AbstractLogEnabled implements Component, Contextualizable
Normalize name component
-
-
Constructor Summary
Constructors Constructor Description NormalizeNameComponent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
contextualize(Context context)
protected String
escapeValue(String value, Connection connection)
Escape column value or commentprotected Map<String,HashMap<String,String>>
getMappingTableColumnNameFromCache()
Get the column name from the cacheprotected Map<String,String>
getMappingTableNameFromCache()
Get the table name from the cacheprotected String
normalizedColumnName(String mappingPolicy, String initialColumnName, String initialTableName, Map<String,Map<String,String>> reservedWords, Connection connection)
Get the normalized column nameprotected String
normalizedComment(String initialComment, int maxLength, Connection connection)
Get the normalized commentprotected String
normalizedTableName(String prefix, String mappingPolicy, String initialTableName, Connection connection)
Get the normalized table nameprotected String
normalizeNameFromPolicy(String mappingPolicy, String initialName)
Normalize the initialName into a name depends on the mapping Policy-
Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
-
-
-
Constructor Detail
-
NormalizeNameComponent
public NormalizeNameComponent()
-
-
Method Detail
-
contextualize
public void contextualize(Context context) throws ContextException
- Specified by:
contextualize
in interfaceContextualizable
- Throws:
ContextException
-
normalizedTableName
protected String normalizedTableName(String prefix, String mappingPolicy, String initialTableName, Connection connection)
Get the normalized table name- Parameters:
prefix
- the table name prefixmappingPolicy
- the mapping policyinitialTableName
- The initial table nameconnection
- the connection- Returns:
- normalized table name
-
normalizedColumnName
protected String normalizedColumnName(String mappingPolicy, String initialColumnName, String initialTableName, Map<String,Map<String,String>> reservedWords, Connection connection)
Get the normalized column name- Parameters:
mappingPolicy
- the mappingPolicyinitialColumnName
- The initial column nameinitialTableName
- The initial table namereservedWords
- the map of reserved wordsconnection
- the connection- Returns:
- normalized column name
-
normalizedComment
protected String normalizedComment(String initialComment, int maxLength, Connection connection)
Get the normalized comment- Parameters:
initialComment
- the initial commentmaxLength
- The maximun number of authorized charactersconnection
- the connection- Returns:
- normalized comment
-
escapeValue
protected String escapeValue(String value, Connection connection)
Escape column value or comment- Parameters:
value
- The value or SQL commentconnection
- the connection- Returns:
- the escaped value
-
getMappingTableNameFromCache
protected Map<String,String> getMappingTableNameFromCache()
Get the table name from the cache- Returns:
- the mapping for table name
-
getMappingTableColumnNameFromCache
protected Map<String,HashMap<String,String>> getMappingTableColumnNameFromCache()
Get the column name from the cache- Returns:
- the mapping for column name
-
normalizeNameFromPolicy
protected String normalizeNameFromPolicy(String mappingPolicy, String initialName)
Normalize the initialName into a name depends on the mapping Policy- Parameters:
mappingPolicy
- (FULL, CAMELCASE, FIRSTCHAR)initialName
- the initial table name- Returns:
- the name changed depends on the mapping Policy
-
-