Class DatabasePersister
- java.lang.Object
-
- com.atlassian.confluence.impl.backuprestore.restore.persisters.DatabasePersister
-
- All Implemented Interfaces:
Persister
public class DatabasePersister extends Object implements Persister
Stores prepared imported objects in the database. THe class receives a batch with mapping between entity infos to the imported objects, then updates ids using idMapper and stores all objects in the database in a single transaction.- Since:
- 7.20.0
-
-
Constructor Summary
Constructors Constructor Description DatabasePersister(RestoreDao restoreDao, EntityInfoSqlHelper entityInfoSqlHelper, IdMapper idMapper, OnObjectsProcessingHandler onObjectsProcessingHandler)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidpersist(Map<ExportableEntityInfo,Collection<ImportedObjectV2>> objectsToPersistGroupedByClass)Persists some or all given objects.booleanshouldPersist(Map<ExportableEntityInfo,Collection<ImportedObjectV2>> objectsWithDatabaseIdsByClass)Checks if should persist any of the given objects.
-
-
-
Constructor Detail
-
DatabasePersister
public DatabasePersister(RestoreDao restoreDao, EntityInfoSqlHelper entityInfoSqlHelper, IdMapper idMapper, OnObjectsProcessingHandler onObjectsProcessingHandler)
- Parameters:
restoreDao- dao that is responsible for persisting objects. All methods are transactionalentityInfoSqlHelper- helps generating SQL codeidMapper- id mapper is required to replace XML IDs with DB IDsonObjectsProcessingHandler- is called when objects are persisted/skipped/etc
-
-
Method Detail
-
shouldPersist
public boolean shouldPersist(Map<ExportableEntityInfo,Collection<ImportedObjectV2>> objectsWithDatabaseIdsByClass)
Description copied from interface:PersisterChecks if should persist any of the given objects.- Specified by:
shouldPersistin interfacePersister- Parameters:
objectsWithDatabaseIdsByClass- - objects to persist.- Returns:
- true if there are objects that this persister can persist. Otherwise, false.
-
persist
public void persist(Map<ExportableEntityInfo,Collection<ImportedObjectV2>> objectsToPersistGroupedByClass) throws BackupRestoreException
Description copied from interface:PersisterPersists some or all given objects.- Specified by:
persistin interfacePersister- Parameters:
objectsToPersistGroupedByClass- - objects to persist.- Throws:
BackupRestoreException- - throws if cannot persist.
-
-