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 Summary
Modifier and TypeFieldDescriptionprotected static final int
protected static final int
-
Constructor Summary
ConstructorDescriptionDatabaseExporterHelper
(BackupContainerWriter containerWriter, HibernateMetadataHelper hibernateMetadataHelper, ParallelTasksExecutor parallelTasksExecutor, org.springframework.transaction.PlatformTransactionManager transactionManager, org.hibernate.SessionFactory sessionFactory, StatisticsCollector statisticsCollector) -
Method Summary
Modifier and TypeMethodDescriptioncheckNameDoesNotHaveSqlInjections
(String tableOrFieldName) Deprecated.<T> T
doInReadOnlyTransaction
(org.springframework.transaction.support.TransactionCallback<T> callback) int
getBatchSize
(ExportableEntityInfo entityInfo) getEntityInfoByClass
(Class<?> entityClazz) org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate
int
org.hibernate.SessionFactory
org.springframework.transaction.PlatformTransactionManager
void
notifyExportersAboutPersistedObjects
(Collection<EntityObjectReadyForExport> exportedObjects) void
registerSubscriber
(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.void
runTaskAsync
(Callable<Void> task, String callerName) void
setAllExporters
(Collection<Exporter> exporters) void
Objects would have references to users, labels etc.void
writeObjects
(Collection<EntityObjectReadyForExport> entities) void
-
Field Details
-
PROCESSING_BATCH_SIZE
protected static final int PROCESSING_BATCH_SIZE -
PROCESSING_BATCH_SIZE_FOR_LARGE_ENTITIES
protected static final int PROCESSING_BATCH_SIZE_FOR_LARGE_ENTITIES
-
-
Constructor Details
-
DatabaseExporterHelper
public DatabaseExporterHelper(BackupContainerWriter containerWriter, HibernateMetadataHelper hibernateMetadataHelper, ParallelTasksExecutor parallelTasksExecutor, org.springframework.transaction.PlatformTransactionManager transactionManager, org.hibernate.SessionFactory sessionFactory, StatisticsCollector statisticsCollector)
-
-
Method Details
-
getContainerWriter
-
getHibernateMetadataHelper
-
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:
InterruptedException
BackupRestoreException
-
notifyExportersAboutPersistedObjects
public void notifyExportersAboutPersistedObjects(Collection<EntityObjectReadyForExport> exportedObjects) throws InterruptedException, BackupRestoreException -
registerSubscriber
-
getNamedParameterJdbcTemplate
public org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() -
doInReadOnlyTransaction
public <T> T doInReadOnlyTransaction(org.springframework.transaction.support.TransactionCallback<T> callback) -
getEntityInfoByClass
-
setAllExporters
-
findSpaceDatabaseExporters
-
writeObjects
public void writeObjects(Collection<EntityObjectReadyForExport> entities) throws BackupRestoreException - Throws:
BackupRestoreException
-
writeObjectsAndNotifyOtherExporters
public void writeObjectsAndNotifyOtherExporters(Collection<EntityObjectReadyForExport> entities) throws BackupRestoreException, InterruptedException -
getBatchSize
-
runTaskAsync
-
checkNameDoesNotHaveSqlInjections
Deprecated.since 7.20.0 useTableAndFieldNameValidator
instead.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()
-
TableAndFieldNameValidator
instead.