Class DatabaseExporterHelper
- java.lang.Object
 - 
- com.atlassian.confluence.impl.backuprestore.backup.exporters.DatabaseExporterHelper
 
 
- 
public class DatabaseExporterHelper extends Object
The helper is used by database exporters.- Since:
 - 7.20.0
 
 
- 
- 
Field Summary
Fields Modifier and Type Field Description protected static intPROCESSING_BATCH_SIZEprotected static intPROCESSING_BATCH_SIZE_FOR_LARGE_ENTITIES 
- 
Constructor Summary
Constructors Constructor Description DatabaseExporterHelper(BackupContainerWriter containerWriter, HibernateMetadataHelper hibernateMetadataHelper, ParallelTasksExecutor parallelTasksExecutor, org.springframework.transaction.PlatformTransactionManager transactionManager, org.hibernate.SessionFactory sessionFactory, StatisticsCollector statisticsCollector) 
- 
Method Summary
 
 - 
 
- 
- 
Constructor Detail
- 
DatabaseExporterHelper
public DatabaseExporterHelper(BackupContainerWriter containerWriter, HibernateMetadataHelper hibernateMetadataHelper, ParallelTasksExecutor parallelTasksExecutor, org.springframework.transaction.PlatformTransactionManager transactionManager, org.hibernate.SessionFactory sessionFactory, StatisticsCollector statisticsCollector)
 
 - 
 
- 
Method Detail
- 
getContainerWriter
public BackupContainerWriter getContainerWriter()
 
- 
getHibernateMetadataHelper
public HibernateMetadataHelper getHibernateMetadataHelper()
 
- 
getParallelTasksExecutor
public ParallelTasksExecutor getParallelTasksExecutor()
 
- 
getTransactionManager
public org.springframework.transaction.PlatformTransactionManager getTransactionManager()
 
- 
getSessionFactory
public org.hibernate.SessionFactory getSessionFactory()
 
- 
writeAllReferencedSimpleObjects
public 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:
 InterruptedExceptionBackupRestoreException
 
- 
notifyExportersAboutPersistedObjects
public void notifyExportersAboutPersistedObjects(Collection<EntityObjectReadyForExport> exportedObjects) throws InterruptedException, BackupRestoreException
 
- 
registerSubscriber
public void registerSubscriber(Subscriber exporter)
 
- 
getNamedParameterJdbcTemplate
public org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate getNamedParameterJdbcTemplate()
 
- 
doInReadOnlyTransaction
public <T> T doInReadOnlyTransaction(org.springframework.transaction.support.TransactionCallback<T> callback)
 
- 
getEntityInfoByClass
public ExportableEntityInfo getEntityInfoByClass(Class<?> entityClazz)
 
- 
setAllExporters
public void setAllExporters(Collection<Exporter> exporters)
 
- 
findSpaceDatabaseExporters
public SpaceDatabaseDataExporter findSpaceDatabaseExporters()
 
- 
writeObjects
public void writeObjects(Collection<EntityObjectReadyForExport> entities) throws BackupRestoreException
- Throws:
 BackupRestoreException
 
- 
writeObjectsAndNotifyOtherExporters
public void writeObjectsAndNotifyOtherExporters(Collection<EntityObjectReadyForExport> entities) throws BackupRestoreException, InterruptedException
 
- 
getBatchSize
public int getBatchSize(ExportableEntityInfo entityInfo)
 
- 
checkNameDoesNotHaveSqlInjections
@Deprecated public String checkNameDoesNotHaveSqlInjections(String tableOrFieldName)
Deprecated.since 7.20.0 useTableAndFieldNameValidatorinstead.Checks that the SQL does not have any SQL injections.- Returns:
 - sql
 
 
- 
runQueryWithInCondition
public List<DbRawObjectData> runQueryWithInCondition(String query, String fieldName, Collection<?> values)
Runs a a native SQL query.- Parameters:
 query- native SQL queryfieldName- field name used in "IN" clausevalues- a collection of values for "IN" clause- Returns:
 
 
- 
runNativeQueryInTransaction
public List<DbRawObjectData> runNativeQueryInTransaction(String query, Map<String,?> paramMap, int limit)
Run an arbitrary native SQL query.- Parameters:
 query- native SQL queryparamMap- parameterslimit- limit- Returns:
 - list of raw data records
 
 
- 
getRegularBatchSize
public int getRegularBatchSize()
 
 - 
 
 -