Class JobsManagementServiceImpl

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void cancelJob​(java.lang.String jobId)
      Cancels the job with the specified ID.
      Job createJob​(Job job)
      This method creates a database entity.
      Job createJob​(java.util.LinkedHashMap<java.lang.String,​java.lang.Object> jobAsMap)
      This method creates a database entity from a map-representation.
      Job decrementJob​(java.lang.String jobId, int step)
      This method save an updates of database entity.
      JobRepository getRepository()  
      Job incrementJob​(java.lang.String jobId, int step)
      This method save an updates of database entity.
      void init()  
      void removeJobAndClean​(java.lang.String jobId)
      This method removes a database entity and clean all relationships from another entities.
      void removeJobsByIds​(java.util.ArrayList<java.lang.String> jobsIds)
      This method removes a list of database entities.
      Job saveJob​(Job job)
      This method save an updates of database entity.
      Job saveJob​(java.util.LinkedHashMap<java.lang.String,​java.lang.Object> jobAsMap)
      This method save an updates of database entity.
      co.mastermindcms.modules.beans.SearchResponse searchJobs​(co.mastermindcms.modules.beans.SearchRequest request)
      This method does search requests and returns data as list.
      co.mastermindcms.modules.beans.SearchResponse searchJobs​(java.util.LinkedHashMap<java.lang.String,​java.lang.Object> requestMap)
      This method does search requests and returns data as list.
      void setUnfinishedJobsToFailed()
      This method updates a list of database entities.
      Job startJob​(java.lang.String type, int total)
      This method save an updates of database entity.
      Job toCanceled​(java.lang.String jobId)
      This method save an updates of database entity.
      Job toDone​(java.lang.String jobId)
      This method save an updates of database entity.
      Job toFailed​(java.lang.String jobId)
      This method save an updates of database entity.
      Job updateProgress​(java.lang.String jobId, int progress)
      This method save an updates of database entity.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • mongoTemplate

        @Autowired
        private org.springframework.data.mongodb.core.MongoTemplate mongoTemplate
      • runningJobs

        private java.util.Map<java.lang.String,​java.lang.Thread> runningJobs
      • mapper

        private static final com.fasterxml.jackson.databind.ObjectMapper mapper
    • Constructor Detail

      • JobsManagementServiceImpl

        public JobsManagementServiceImpl()
    • Method Detail

      • init

        @PostConstruct
        public void init()
      • searchJobs

        public co.mastermindcms.modules.beans.SearchResponse searchJobs​(java.util.LinkedHashMap<java.lang.String,​java.lang.Object> requestMap)
        Description copied from interface: JobsManagementService
        This method does search requests and returns data as list.
        Specified by:
        searchJobs in interface JobsManagementService
        Parameters:
        requestMap - JSON-object of request contains an instructions for search queries
        Returns:
        data transport entities as list
      • searchJobs

        public co.mastermindcms.modules.beans.SearchResponse searchJobs​(co.mastermindcms.modules.beans.SearchRequest request)
        Description copied from interface: JobsManagementService
        This method does search requests and returns data as list.
        Specified by:
        searchJobs in interface JobsManagementService
        Parameters:
        request - JSON-object of request contains an instructions for search queries
        Returns:
        data transport entities as list
      • createJob

        public Job createJob​(java.util.LinkedHashMap<java.lang.String,​java.lang.Object> jobAsMap)
        Description copied from interface: JobsManagementService
        This method creates a database entity from a map-representation.
        Specified by:
        createJob in interface JobsManagementService
        Parameters:
        jobAsMap - map-representation of database entity
        Returns:
        created instance of database entity
      • saveJob

        public Job saveJob​(java.util.LinkedHashMap<java.lang.String,​java.lang.Object> jobAsMap)
        Description copied from interface: JobsManagementService
        This method save an updates of database entity.
        Specified by:
        saveJob in interface JobsManagementService
        Parameters:
        jobAsMap - map-representation of database entity
        Returns:
        saved instance of database entity
      • saveJob

        public Job saveJob​(Job job)
        Description copied from interface: JobsManagementService
        This method save an updates of database entity.
        Specified by:
        saveJob in interface JobsManagementService
        Parameters:
        job - database entity for a update
        Returns:
        saved instance of database entity
      • startJob

        public Job startJob​(java.lang.String type,
                            int total)
        Description copied from interface: JobsManagementService
        This method save an updates of database entity.
        Specified by:
        startJob in interface JobsManagementService
        Parameters:
        type - database entity type for a update
        total - count of iterations
        Returns:
        saved instance of database entity
      • cancelJob

        public void cancelJob​(java.lang.String jobId)
        Description copied from interface: JobsManagementService
        Cancels the job with the specified ID.
        Specified by:
        cancelJob in interface JobsManagementService
        Parameters:
        jobId - the ID of the job to be canceled
      • toCanceled

        public Job toCanceled​(java.lang.String jobId)
        Description copied from interface: JobsManagementService
        This method save an updates of database entity.
        Specified by:
        toCanceled in interface JobsManagementService
        Parameters:
        jobId - database entity id for a update
        Returns:
        saved instance of database entity
      • toDone

        public Job toDone​(java.lang.String jobId)
        Description copied from interface: JobsManagementService
        This method save an updates of database entity.
        Specified by:
        toDone in interface JobsManagementService
        Parameters:
        jobId - database entity id for a update
        Returns:
        saved instance of database entity
      • updateProgress

        public Job updateProgress​(java.lang.String jobId,
                                  int progress)
        Description copied from interface: JobsManagementService
        This method save an updates of database entity.
        Specified by:
        updateProgress in interface JobsManagementService
        Parameters:
        jobId - database entity id for a update
        progress - percentage of job is done
        Returns:
        saved instance of database entity
      • incrementJob

        public Job incrementJob​(java.lang.String jobId,
                                int step)
        Description copied from interface: JobsManagementService
        This method save an updates of database entity.
        Specified by:
        incrementJob in interface JobsManagementService
        Parameters:
        jobId - database entity id for a update
        step - step of incremental
        Returns:
        saved instance of database entity
      • decrementJob

        public Job decrementJob​(java.lang.String jobId,
                                int step)
        Description copied from interface: JobsManagementService
        This method save an updates of database entity.
        Specified by:
        decrementJob in interface JobsManagementService
        Parameters:
        jobId - database entity id for a update
        step - step of decremental
        Returns:
        saved instance of database entity
      • toFailed

        public Job toFailed​(java.lang.String jobId)
        Description copied from interface: JobsManagementService
        This method save an updates of database entity.
        Specified by:
        toFailed in interface JobsManagementService
        Parameters:
        jobId - database entity id for a update
        Returns:
        saved instance of database entity
      • removeJobsByIds

        public void removeJobsByIds​(java.util.ArrayList<java.lang.String> jobsIds)
        Description copied from interface: JobsManagementService
        This method removes a list of database entities.
        Specified by:
        removeJobsByIds in interface JobsManagementService
        Parameters:
        jobsIds - the list of database entities which will be removed
      • removeJobAndClean

        public void removeJobAndClean​(java.lang.String jobId)
        Description copied from interface: JobsManagementService
        This method removes a database entity and clean all relationships from another entities.
        Specified by:
        removeJobAndClean in interface JobsManagementService
        Parameters:
        jobId - identification for database entity which will be removed