Class BackupRestoreJobDao
- java.lang.Object
 - 
- com.atlassian.confluence.impl.backuprestore.dao.BackupRestoreJobDao
 
 
- 
public class BackupRestoreJobDao extends Object
Dao for backup/restore jobs.- Since:
 - 8.3.0
 
 
- 
- 
Field Summary
Fields Modifier and Type Field Description static StringCANCEL_TIMEstatic StringEXISTING_EXPECTED_STATEstatic StringFINISH_PROCESSING_TIMEstatic StringIDstatic StringNEW_STATEstatic StringSTART_PROCESSING_TIMEstatic StringSTATISTICSstatic StringTERMINATOR 
- 
Constructor Summary
Constructors Constructor Description BackupRestoreJobDao(@NotNull org.hibernate.SessionFactory sessionFactory) 
- 
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancancelQueuedJobWithOptimisticLock(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 statisticsList<BackupRestoreJob>findJobs(BackupRestoreJobsSearchFilter backupRestoreJobsSearchFilter)List<BackupRestoreJob>findJobsWithExpiredZips()This gets all jobs where the file delete time is expired and the backup zip file still existsBackupRestoreJobgetById(Long jobId)BackupRestoreJobgetNextActiveJob()BackupRestoreJobgetNextJobForProcessing()BackupRestoreJobSettingsRecordgetSettingsById(long id)BackupRestoreJobStatisticsRecordgetStatisticsById(long id)BackupRestoreJobsave(BackupRestoreJob job)Longsave(BackupRestoreJobSettingsRecord backupRestoreJobSettingsRecord)voidsave(BackupRestoreJobStatisticsRecord statisticsRecord)BackupRestoreJobsaveAndKeepId(BackupRestoreJob job)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)voidupdateInNewTransaction(BackupRestoreJob job)intupdateStatistics(long jobId, String statistics) 
 - 
 
- 
- 
Field Detail
- 
NEW_STATE
public static final String NEW_STATE
- See Also:
 - Constant Field Values
 
 
- 
EXISTING_EXPECTED_STATE
public static final String EXISTING_EXPECTED_STATE
- See Also:
 - Constant Field Values
 
 
- 
CANCEL_TIME
public static final String CANCEL_TIME
- See Also:
 - Constant Field Values
 
 
- 
TERMINATOR
public static final String TERMINATOR
- See Also:
 - Constant Field Values
 
 
- 
ID
public static final String ID
- See Also:
 - Constant Field Values
 
 
- 
FINISH_PROCESSING_TIME
public static final String FINISH_PROCESSING_TIME
- See Also:
 - Constant Field Values
 
 
- 
START_PROCESSING_TIME
public static final String START_PROCESSING_TIME
- See Also:
 - Constant Field Values
 
 
- 
STATISTICS
public static final String STATISTICS
- See Also:
 - Constant Field Values
 
 
 - 
 
- 
Method Detail
- 
getById
@Transactional(readOnly=true) public BackupRestoreJob getById(Long jobId)
 
- 
save
@Transactional public BackupRestoreJob save(BackupRestoreJob job)
 
- 
update
@Transactional public void update(BackupRestoreJob job)
 
- 
updateInNewTransaction
@Transactional(propagation=REQUIRES_NEW) public void updateInNewTransaction(BackupRestoreJob job)
 
- 
findJobs
@Transactional(readOnly=true) public List<BackupRestoreJob> findJobs(BackupRestoreJobsSearchFilter backupRestoreJobsSearchFilter)
 
- 
cancelRunningJobWithOptimisticLock
@Transactional public boolean cancelRunningJobWithOptimisticLock(long jobId, String terminator)Cancels the job only if it's state was not modified.- Parameters:
 jobId- job idterminator- user who wants to cancel the job- Returns:
 - true if job was cancelled
 
 
- 
cancelQueuedJobWithOptimisticLock
@Transactional public boolean cancelQueuedJobWithOptimisticLock(long jobId, String terminator)Cancels the job only if it's state was not modified.- 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.- Parameters:
 jobId- job id- Returns:
 - true if job changed it's state to processing
 
 
- 
getNextJobForProcessing
@Transactional(readOnly=true) public BackupRestoreJob getNextJobForProcessing()
 
- 
getNextActiveJob
@Transactional(readOnly=true) public BackupRestoreJob getNextActiveJob()
 
- 
getSettingsById
@Transactional(readOnly=true) public BackupRestoreJobSettingsRecord getSettingsById(long id) throws IllegalStateException
- Throws:
 IllegalStateException
 
- 
getStatisticsById
@Transactional(readOnly=true) public BackupRestoreJobStatisticsRecord getStatisticsById(long id)
 
- 
save
@Transactional public Long save(BackupRestoreJobSettingsRecord backupRestoreJobSettingsRecord)
 
- 
save
@Transactional public void save(BackupRestoreJobStatisticsRecord statisticsRecord)
 
- 
updateStatistics
@Transactional public int updateStatistics(long jobId, String statistics) 
- 
saveAndKeepId
@Transactional public BackupRestoreJob saveAndKeepId(BackupRestoreJob job)
Regular save generates the new id if the object does not exist. This method reuses existing id. 
- 
findJobsWithExpiredZips
@Transactional(readOnly=true) public List<BackupRestoreJob> findJobsWithExpiredZips()
This gets all jobs where the file delete time is expired and the backup zip file still exists- Returns:
 - list of jobs to delete
 
 
- 
delete
@Transactional public void delete(long jobId)
Deletes given job with its settings and statistics- Parameters:
 jobId- - job id of the job to be deleted
 
 - 
 
 -