Class DefaultBackupRestoreJobDao
java.lang.Object
com.atlassian.confluence.impl.backuprestore.dao.DefaultBackupRestoreJobDao
- All Implemented Interfaces:
BackupRestoreJobDao
Dao for backup/restore jobs.
- Since:
- 9.3
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefaultBackupRestoreJobDao(@NonNull org.hibernate.SessionFactory sessionFactory) -
Method Summary
Modifier and TypeMethodDescriptionbooleancancelQueuedJobWithOptimisticLock(long jobId, String terminator) Cancels the job only if it's state was not modified.booleancancelRunningJobWithOptimisticLock(long jobId, String terminator) Cancels the job only if it's state was not modified.voiddelete(long jobId) Deletes given job with its settings and statisticsfindJobs(BackupRestoreJobsSearchFilter backupRestoreJobsSearchFilter) This gets all jobs where the file delete time is expired and the backup zip file still existsgetSettingsById(long id) getStatisticsById(long id) save(BackupRestoreJob job) save(BackupRestoreJobSettingsRecord backupRestoreJobSettingsRecord) voidsave(BackupRestoreJobStatisticsRecord statisticsRecord) Regular save generates the new id if the object does not exist.booleanstartProcessingJobWithOptimisticLock(long jobId) Changes jobs state to PROCESSING only if it's state was not modified.voidupdate(BackupRestoreJob job) voidintupdateStatistics(long jobId, String statistics)
-
Field Details
-
NEW_STATE
- See Also:
-
EXISTING_EXPECTED_STATE
- See Also:
-
CANCEL_TIME
- See Also:
-
TERMINATOR
- See Also:
-
ID
- See Also:
-
FINISH_PROCESSING_TIME
- See Also:
-
START_PROCESSING_TIME
- See Also:
-
STATISTICS
- See Also:
-
-
Constructor Details
-
DefaultBackupRestoreJobDao
public DefaultBackupRestoreJobDao(@NonNull org.hibernate.SessionFactory sessionFactory)
-
-
Method Details
-
getById
- Specified by:
getByIdin interfaceBackupRestoreJobDao
-
save
- Specified by:
savein interfaceBackupRestoreJobDao
-
update
- Specified by:
updatein interfaceBackupRestoreJobDao
-
updateInNewTransaction
- Specified by:
updateInNewTransactionin interfaceBackupRestoreJobDao
-
findJobs
@Transactional(readOnly=true) public List<BackupRestoreJob> findJobs(BackupRestoreJobsSearchFilter backupRestoreJobsSearchFilter) - Specified by:
findJobsin interfaceBackupRestoreJobDao
-
cancelRunningJobWithOptimisticLock
Cancels the job only if it's state was not modified.- Specified by:
cancelRunningJobWithOptimisticLockin interfaceBackupRestoreJobDao- Parameters:
jobId- job idterminator- user who wants to cancel the job- Returns:
- true if job was cancelled
-
cancelQueuedJobWithOptimisticLock
Cancels the job only if it's state was not modified.- Specified by:
cancelQueuedJobWithOptimisticLockin interfaceBackupRestoreJobDao- Parameters:
jobId- job idterminator- user who wants to cancel the job- Returns:
- true if job was cancelled
-
startProcessingJobWithOptimisticLock
@Transactional public boolean startProcessingJobWithOptimisticLock(long jobId) Changes jobs state to PROCESSING only if it's state was not modified.- Specified by:
startProcessingJobWithOptimisticLockin interfaceBackupRestoreJobDao- Parameters:
jobId- job id- Returns:
- true if job changed it's state to processing
-
getNextJobForProcessing
- Specified by:
getNextJobForProcessingin interfaceBackupRestoreJobDao
-
getNextActiveJob
- Specified by:
getNextActiveJobin interfaceBackupRestoreJobDao
-
getSettingsById
@Transactional(readOnly=true) public BackupRestoreJobSettingsRecord getSettingsById(long id) throws IllegalStateException - Specified by:
getSettingsByIdin interfaceBackupRestoreJobDao- Throws:
IllegalStateException
-
getStatisticsById
- Specified by:
getStatisticsByIdin interfaceBackupRestoreJobDao
-
save
- Specified by:
savein interfaceBackupRestoreJobDao
-
save
- Specified by:
savein interfaceBackupRestoreJobDao
-
updateStatistics
- Specified by:
updateStatisticsin interfaceBackupRestoreJobDao
-
saveAndKeepId
Regular save generates the new id if the object does not exist. This method reuses existing id.- Specified by:
saveAndKeepIdin interfaceBackupRestoreJobDao
-
findJobsWithExpiredZips
This gets all jobs where the file delete time is expired and the backup zip file still exists- Specified by:
findJobsWithExpiredZipsin interfaceBackupRestoreJobDao- Returns:
- list of jobs to delete
-
delete
@Transactional public void delete(long jobId) Deletes given job with its settings and statistics- Specified by:
deletein interfaceBackupRestoreJobDao- Parameters:
jobId- - job id of the job to be deleted
-