Class FillSqlTableComponent
java.lang.Object
org.ametys.runtime.plugin.component.AbstractLogEnabled
org.ametys.plugins.contentio.export.sql.FillSqlTableComponent
- All Implemented Interfaces:
LogEnabled
,Component
,Serviceable
Fill sql table component
-
Field Summary
Modifier and TypeFieldDescriptionprotected ContentTypeExtensionPoint
Content type extension point.The configured list of content types to export associated to the SQL table name to useprotected I18nUtils
The i18n translator.protected LanguagesManager
The language managerprotected NormalizeNameComponent
The normalise name component.protected AmetysObjectResolver
The ametys object resolver.protected UserManager
The user managerstatic final String
The component role -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
fillAdditionalData
(ExportCounter fillIndex, Content content, PreparedStatement stmt) Add additional values for content (Title, type, language, creator, creationDate, ...)protected void
fillColumnForRichTextData
(RichText richText, String attributeName, String contentId) Fill column for data in rich textvoid
fillTable
(ExportConfiguration exportConfiguration, Map<String, ExportTableInfo> tableInfo) Fill table with contentsprotected void
fillTableForContentType
(String contentTypeId) Fill values from JCR request with specific content typeprotected void
fillTableForMultipleAttribute
(ElementDefinition definition, ModelAwareDataHolder dataHolder, String name, String tableName, String id) Fill values from multiple attributeprotected void
fillTableForRepeater
(RepeaterDefinition definition, ModelAwareRepeater repeater, String tableName, String id) Fill values from a repeaterprotected void
fillValue
(ExportCounter fillIndex, ElementDefinition definition, ModelAwareDataHolder dataHolder, String name, String id, PreparedStatement stmt) Fill values from an attributeprotected void
fillValues
(ExportCounter fillIndex, ModelItemContainer modelItemContainer, ModelAwareDataHolder dataHolder, String tableName, String columnNamePrefix, String id, PreparedStatement stmt) Fill values from a composite metadataprotected PreparedStatement
getInsertPreparedStatementFromTableName
(String prefix, String tableName, String mappingPolicy) Prepare INSERT statementprotected String
getTableName
(String cTypeId) Get the name of SQL table for given content typeprotected void
Fill the SQL tables with values from JCRvoid
service
(ServiceManager manager) Methods inherited from class org.ametys.runtime.plugin.component.AbstractLogEnabled
getLogger, setLogger
-
Field Details
-
ROLE
The component role -
_contentTypeExtensionPoint
Content type extension point. -
_resolver
The ametys object resolver. -
_normalizeNameComponent
The normalise name component. -
_contentTypesToExport
The configured list of content types to export associated to the SQL table name to use -
_i18nTranslator
The i18n translator. -
_languageManager
The language manager -
_userManager
The user manager
-
-
Constructor Details
-
FillSqlTableComponent
public FillSqlTableComponent()
-
-
Method Details
-
service
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
fillTable
public void fillTable(ExportConfiguration exportConfiguration, Map<String, ExportTableInfo> tableInfo) throws SQLException, AmetysRepositoryExceptionFill table with contents- Parameters:
exportConfiguration
- the content export configurationtableInfo
- the map of table information- Throws:
SQLException
- if a sql error occurredAmetysRepositoryException
- if an ametys repository error occurred
-
insertValues
Fill the SQL tables with values from JCR- Throws:
SQLException
- if a sql error occurredAmetysRepositoryException
- if an ametys repository error occurred
-
fillTableForContentType
protected void fillTableForContentType(String contentTypeId) throws SQLException, AmetysRepositoryException Fill values from JCR request with specific content type- Parameters:
contentTypeId
- the content type id- Throws:
SQLException
- if a sql error occurredAmetysRepositoryException
- if an ametys repository error occurred
-
fillValues
protected void fillValues(ExportCounter fillIndex, ModelItemContainer modelItemContainer, ModelAwareDataHolder dataHolder, String tableName, String columnNamePrefix, String id, PreparedStatement stmt) throws SQLException, AmetysRepositoryException Fill values from a composite metadata- Parameters:
fillIndex
- the position indicator in the insert statementmodelItemContainer
- the attribute definitionsdataHolder
- theModelAwareDataHolder
tableName
- the table namecolumnNamePrefix
- the column name prefixid
- the content idstmt
- the jdbc statement- Throws:
SQLException
- if a sql error occurredAmetysRepositoryException
- if an ametys repository error occurred
-
fillTableForRepeater
protected void fillTableForRepeater(RepeaterDefinition definition, ModelAwareRepeater repeater, String tableName, String id) throws SQLException, AmetysRepositoryException Fill values from a repeater- Parameters:
definition
- the repeater definitionrepeater
- the repeatertableName
- the table nameid
- the content id- Throws:
SQLException
- if a sql error occurredAmetysRepositoryException
- if an ametys repository error occurred
-
fillTableForMultipleAttribute
protected void fillTableForMultipleAttribute(ElementDefinition definition, ModelAwareDataHolder dataHolder, String name, String tableName, String id) throws SQLException Fill values from multiple attribute- Parameters:
definition
- the attribute definitiondataHolder
- theModelAwareDataHolder
name
- the attribute nametableName
- the table nameid
- the content id- Throws:
SQLException
- if a sql error occurred
-
fillValue
protected void fillValue(ExportCounter fillIndex, ElementDefinition definition, ModelAwareDataHolder dataHolder, String name, String id, PreparedStatement stmt) throws SQLException, AmetysRepositoryException Fill values from an attribute- Parameters:
fillIndex
- the position indicator in the insert statementdefinition
- the metadata definition modeldataHolder
- theModelAwareDataHolder
name
- the attribute nameid
- the content idstmt
- the jdbc statement- Throws:
SQLException
- if a sql error occurredAmetysRepositoryException
- if an ametys repository error occurred
-
fillAdditionalData
protected void fillAdditionalData(ExportCounter fillIndex, Content content, PreparedStatement stmt) throws AmetysRepositoryException, SQLException Add additional values for content (Title, type, language, creator, creationDate, ...)- Parameters:
fillIndex
- the position indicator in the insert statementcontent
- the contentstmt
- the jdbc statement- Throws:
SQLException
- if a sql error occurredAmetysRepositoryException
- if an ametys repository error occurred
-
fillColumnForRichTextData
protected void fillColumnForRichTextData(RichText richText, String attributeName, String contentId) throws AmetysRepositoryException, SQLException Fill column for data in rich text- Parameters:
richText
- the rich textattributeName
- the metadata namecontentId
- the content id- Throws:
AmetysRepositoryException
- if an error occurredSQLException
- if a sql error occurred
-
getInsertPreparedStatementFromTableName
protected PreparedStatement getInsertPreparedStatementFromTableName(String prefix, String tableName, String mappingPolicy) throws SQLException Prepare INSERT statement- Parameters:
prefix
- the table prefixtableName
- the table namemappingPolicy
- the mapping policy- Returns:
- the INSERT preparedStatement
- Throws:
SQLException
- if a sql error occurred
-
getTableName
Get the name of SQL table for given content type- Parameters:
cTypeId
- The id of content type- Returns:
- the name of SQL table or null if not found
-