Class DatabaseExporterHelper
java.lang.Object
com.atlassian.confluence.impl.backuprestore.backup.exporters.DatabaseExporterHelper
The helper is used by database exporters.
- Since:
- 7.20.0
- 
Field SummaryFieldsModifier and TypeFieldDescriptionprotected static final intprotected static final int
- 
Constructor SummaryConstructorsConstructorDescriptionDatabaseExporterHelper(BackupContainerWriter containerWriter, HibernateMetadataHelper hibernateMetadataHelper, ParallelTasksExecutor parallelTasksExecutor, org.springframework.transaction.PlatformTransactionManager transactionManager, org.hibernate.SessionFactory sessionFactory, StatisticsCollector statisticsCollector) 
- 
Method SummaryModifier and TypeMethodDescriptioncheckNameDoesNotHaveSqlInjections(String tableOrFieldName) Deprecated.<T> TdoInReadOnlyTransaction(org.springframework.transaction.support.TransactionCallback<T> callback) intgetBatchSize(ExportableEntityInfo entityInfo) getEntityInfoByClass(Class<?> entityClazz) org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplateintorg.hibernate.SessionFactoryorg.springframework.transaction.PlatformTransactionManagervoidnotifyExportersAboutPersistedObjects(Collection<EntityObjectReadyForExport> exportedObjects) voidregisterSubscriber(Subscriber exporter) runNativeQueryInTransaction(String query, Map<String, ?> paramMap, int limit) Run an arbitrary native SQL query.runQueryWithInCondition(String query, String fieldName, Collection<?> values) Runs a a native SQL query.voidrunTaskAsync(Callable<Void> task, String callerName) voidsetAllExporters(Collection<Exporter> exporters) voidObjects would have references to users, labels etc.voidwriteObjects(Collection<EntityObjectReadyForExport> entities) void
- 
Field Details- 
PROCESSING_BATCH_SIZEprotected static final int PROCESSING_BATCH_SIZE
- 
PROCESSING_BATCH_SIZE_FOR_LARGE_ENTITIESprotected static final int PROCESSING_BATCH_SIZE_FOR_LARGE_ENTITIES
 
- 
- 
Constructor Details- 
DatabaseExporterHelperpublic DatabaseExporterHelper(BackupContainerWriter containerWriter, HibernateMetadataHelper hibernateMetadataHelper, ParallelTasksExecutor parallelTasksExecutor, org.springframework.transaction.PlatformTransactionManager transactionManager, org.hibernate.SessionFactory sessionFactory, StatisticsCollector statisticsCollector) 
 
- 
- 
Method Details- 
getContainerWriter
- 
getHibernateMetadataHelper
- 
getParallelTasksExecutor
- 
getTransactionManagerpublic org.springframework.transaction.PlatformTransactionManager getTransactionManager()
- 
getSessionFactorypublic org.hibernate.SessionFactory getSessionFactory()
- 
writeAllReferencedSimpleObjectspublic void writeAllReferencedSimpleObjects(Collection<EntityObjectReadyForExport> entities) throws InterruptedException, BackupRestoreException Objects would have references to users, labels etc. If we write an object, for example, a page, and we have a reference to a user, we have to persist that user as well. We do not export all the users from the database, only users that are referenced from other objects. For example, we have 1 million of users, but in the exported space, we have references to 100 users only. That means that the exported file will have only 100 users (not 1 million).- Parameters:
- entities-
- Throws:
- InterruptedException
- BackupRestoreException
 
- 
notifyExportersAboutPersistedObjectspublic void notifyExportersAboutPersistedObjects(Collection<EntityObjectReadyForExport> exportedObjects) throws InterruptedException, BackupRestoreException 
- 
registerSubscriber
- 
getNamedParameterJdbcTemplatepublic org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate getNamedParameterJdbcTemplate()
- 
doInReadOnlyTransactionpublic <T> T doInReadOnlyTransaction(org.springframework.transaction.support.TransactionCallback<T> callback) 
- 
getEntityInfoByClass
- 
setAllExporters
- 
findSpaceDatabaseExporters
- 
writeObjectspublic void writeObjects(Collection<EntityObjectReadyForExport> entities) throws BackupRestoreException - Throws:
- BackupRestoreException
 
- 
writeObjectsAndNotifyOtherExporterspublic void writeObjectsAndNotifyOtherExporters(Collection<EntityObjectReadyForExport> entities) throws BackupRestoreException, InterruptedException 
- 
getBatchSize
- 
runTaskAsync
- 
checkNameDoesNotHaveSqlInjectionsDeprecated.since 7.20.0 useTableAndFieldNameValidatorinstead.Checks that the SQL does not have any SQL injections.- Returns:
- sql
 
- 
runQueryWithInConditionpublic List<DbRawObjectData> runQueryWithInCondition(String query, String fieldName, Collection<?> values) Runs a a native SQL query.- Parameters:
- query- native SQL query
- fieldName- field name used in "IN" clause
- values- a collection of values for "IN" clause
- Returns:
 
- 
runNativeQueryInTransactionpublic List<DbRawObjectData> runNativeQueryInTransaction(String query, Map<String, ?> paramMap, int limit) Run an arbitrary native SQL query.- Parameters:
- query- native SQL query
- paramMap- parameters
- limit- limit
- Returns:
- list of raw data records
 
- 
getRegularBatchSizepublic int getRegularBatchSize()
 
- 
TableAndFieldNameValidatorinstead.