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 TypeMethodDescriptionboolean
cancelQueuedJobWithOptimisticLock
(long jobId, String terminator) Cancels the job only if it's state was not modified.boolean
cancelRunningJobWithOptimisticLock
(long jobId, String terminator) Cancels the job only if it's state was not modified.void
delete
(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) void
save
(BackupRestoreJobStatisticsRecord statisticsRecord) Regular save generates the new id if the object does not exist.boolean
startProcessingJobWithOptimisticLock
(long jobId) Changes jobs state to PROCESSING only if it's state was not modified.void
update
(BackupRestoreJob job) void
int
updateStatistics
(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:
getById
in interfaceBackupRestoreJobDao
-
save
- Specified by:
save
in interfaceBackupRestoreJobDao
-
update
- Specified by:
update
in interfaceBackupRestoreJobDao
-
updateInNewTransaction
- Specified by:
updateInNewTransaction
in interfaceBackupRestoreJobDao
-
findJobs
@Transactional(readOnly=true) public List<BackupRestoreJob> findJobs(BackupRestoreJobsSearchFilter backupRestoreJobsSearchFilter) - Specified by:
findJobs
in interfaceBackupRestoreJobDao
-
cancelRunningJobWithOptimisticLock
Cancels the job only if it's state was not modified.- Specified by:
cancelRunningJobWithOptimisticLock
in 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:
cancelQueuedJobWithOptimisticLock
in 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:
startProcessingJobWithOptimisticLock
in interfaceBackupRestoreJobDao
- Parameters:
jobId
- job id- Returns:
- true if job changed it's state to processing
-
getNextJobForProcessing
- Specified by:
getNextJobForProcessing
in interfaceBackupRestoreJobDao
-
getNextActiveJob
- Specified by:
getNextActiveJob
in interfaceBackupRestoreJobDao
-
getSettingsById
@Transactional(readOnly=true) public BackupRestoreJobSettingsRecord getSettingsById(long id) throws IllegalStateException - Specified by:
getSettingsById
in interfaceBackupRestoreJobDao
- Throws:
IllegalStateException
-
getStatisticsById
- Specified by:
getStatisticsById
in interfaceBackupRestoreJobDao
-
save
- Specified by:
save
in interfaceBackupRestoreJobDao
-
save
- Specified by:
save
in interfaceBackupRestoreJobDao
-
updateStatistics
- Specified by:
updateStatistics
in interfaceBackupRestoreJobDao
-
saveAndKeepId
Regular save generates the new id if the object does not exist. This method reuses existing id.- Specified by:
saveAndKeepId
in interfaceBackupRestoreJobDao
-
findJobsWithExpiredZips
This gets all jobs where the file delete time is expired and the backup zip file still exists- Specified by:
findJobsWithExpiredZips
in interfaceBackupRestoreJobDao
- Returns:
- list of jobs to delete
-
delete
@Transactional public void delete(long jobId) Deletes given job with its settings and statistics- Specified by:
delete
in interfaceBackupRestoreJobDao
- Parameters:
jobId
- - job id of the job to be deleted
-