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
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
contextualize
(Context context) protected String
escapeValue
(String value, Connection connection) Escape column value or commentGet the column name from the cacheGet 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 PolicyMethods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
The component role -
_context
The avalon context.
-
-
Constructor Details
-
NormalizeNameComponent
public NormalizeNameComponent()
-
-
Method Details
-
contextualize
- 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
Get the normalized comment- Parameters:
initialComment
- the initial commentmaxLength
- The maximun number of authorized charactersconnection
- the connection- Returns:
- normalized comment
-
escapeValue
Escape column value or comment- Parameters:
value
- The value or SQL commentconnection
- the connection- Returns:
- the escaped value
-
getMappingTableNameFromCache
Get the table name from the cache- Returns:
- the mapping for table name
-
getMappingTableColumnNameFromCache
Get the column name from the cache- Returns:
- the mapping for column name
-
normalizeNameFromPolicy
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
-