Class BackupRestoreJobDao


  • public class BackupRestoreJobDao
    extends Object
    Dao for backup/restore jobs.
    Since:
    8.3.0
    • Constructor Detail

      • BackupRestoreJobDao

        public BackupRestoreJobDao​(@NonNull org.hibernate.SessionFactory sessionFactory)
    • Method Detail

      • updateInNewTransaction

        @Transactional(propagation=REQUIRES_NEW)
        public void updateInNewTransaction​(BackupRestoreJob job)
      • cancelRunningJobWithOptimisticLock

        @Transactional
        public boolean cancelRunningJobWithOptimisticLock​(long jobId,
                                                          String terminator)
        Cancels the job only if it's state was not modified.
        Parameters:
        jobId - job id
        terminator - 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 id
        terminator - 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()
      • 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