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 String
CANCEL_TIME
static String
EXISTING_EXPECTED_STATE
static String
FINISH_PROCESSING_TIME
static String
ID
static String
NEW_STATE
static String
START_PROCESSING_TIME
static String
STATISTICS
static String
TERMINATOR
-
Constructor Summary
Constructors Constructor Description BackupRestoreJobDao(@NonNull org.hibernate.SessionFactory sessionFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
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 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 existsBackupRestoreJob
getById(Long jobId)
BackupRestoreJob
getNextActiveJob()
BackupRestoreJob
getNextJobForProcessing()
BackupRestoreJobSettingsRecord
getSettingsById(long id)
BackupRestoreJobStatisticsRecord
getStatisticsById(long id)
BackupRestoreJob
save(BackupRestoreJob job)
Long
save(BackupRestoreJobSettingsRecord backupRestoreJobSettingsRecord)
void
save(BackupRestoreJobStatisticsRecord statisticsRecord)
BackupRestoreJob
saveAndKeepId(BackupRestoreJob job)
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
updateInNewTransaction(BackupRestoreJob job)
int
updateStatistics(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
-
-