Class JobDao


  • public class JobDao
    extends AbstractDao
    Provides a DAO for the Collaboration Job entity.
    Since:
    4.0.0
    See Also:
    Job
    • Constructor Detail

      • JobDao

        public JobDao()
    • Method Detail

      • getJobForPK

        public Job getJobForPK​(Object id)
        Return the Job object for the given primary key or null if not found.
        Parameters:
        id - the Job ID
        Returns:
        the Job object for the given primary key or null if not found
      • getJobForKey

        public Job getJobForKey​(String jobKey)
        Return the Job object for the given job key or null if not found.
        Parameters:
        jobKey - the Job Key
        Returns:
        the Job object for the given job key or null if not found
      • getJobForReferenceNumber

        public Job getJobForReferenceNumber​(String referenceNumber)
        Return the first Job object for the given reference number or null if not found.
        Parameters:
        referenceNumber - the Job Key
        Returns:
        the first Job object for the given reference number or null if not found
        Since:
        4.2.1
      • getJobsReadyToProcess

        public List<Job> getJobsReadyToProcess()
        Return the list of jobs ready to process. To ensure the job processing is fairly balanced across all jobs needing processing this method will return a result list ordered by unprocessed job, then jobs last processed time.
        Returns:
        the list of jobs ready to process
      • getJobList

        public List<Job> getJobList​(String clientId,
                                    String searchString,
                                    String status,
                                    String serviceId,
                                    Date startDate,
                                    Date endDate)
        Return the list of jobs matching the specified search criteria. The list of results will be sorted by creation time in descending order.
        Parameters:
        clientId - the client ID to filter on (optional; if not set, user-specific client filtering will be applied)
        searchString - the search string entered by the user (optional)
        status - the status (optional)
        serviceId - the controller Service Definition ID
        startDate - the lower bound on the creation time
        endDate - the upper bound on the creation time
        Returns:
        the list of matching jobs
      • getJobListForKeywordOrProperty

        public List<Job> getJobListForKeywordOrProperty​(String clientId,
                                                        String jobKeyword,
                                                        String jobStatus,
                                                        Date startDate,
                                                        Date endDate,
                                                        String propertyName,
                                                        String propertyValue)
        Return the list of jobs which match the specified search criteria. If the jobKeyword is specified this will be used to search for the job name using a like match expression, or the job reference number using an exact match expression, or the job key if the keyword is a 32 character alphanumeric expression.

        If the propertyName and propertyValue criteria is specified then the search will filter on job with job properties which have the specified property name (exact match) and job property value (like match).

        Parameters:
        clientId - the client ID (optional)
        jobKeyword - the job keyword (optional)
        jobStatus - the job status (optional)
        startDate - the job creation start date (optional)
        endDate - the job creation end date (optional)
        propertyName - the job property name (optional)
        propertyValue - the job property value (optional)
        Returns:
        the list of jobs which match the specified search criteria
        Since:
        4.3.4
      • getJobList

        public List<Job> getJobList​(String keyword,
                                    String jobStatus,
                                    Date fromDate,
                                    Portal portal)
        Deprecated.
        Return the list of Jobs for the given search criteria.
        Parameters:
        keyword - the search keyword
        jobStatus - the job status
        fromDate - the start date
        portal - the portals client associations
        Returns:
        the list Jobs for the given search criteria.
      • getJobList

        public List<Job> getJobList​(String keyword,
                                    String jobStatus,
                                    Date fromDate,
                                    Portal portal,
                                    String loginName)
        Deprecated.
        Return the list of Jobs for the given search criteria.
        Parameters:
        keyword - the search keyword
        jobStatus - the job status
        fromDate - the start date
        portal - the portals client associations
        loginName - the login name to filter on (optional)
        Returns:
        the list of jobs for the given search criteria
        Since:
        4.3.1
      • getNumberOfJobsCreated

        public int getNumberOfJobsCreated​(Date startDate,
                                          Date endDate,
                                          Client client)
        Return the number of jobs created within a certain date range and optionally matching a specific client. Other attributes such as current job status are not considered.
        Parameters:
        startDate - the start date (required, inclusive)
        endDate - the end date (required, exclusive)
        client - the organization to match (optional)
        Returns:
        the number of jobs created during the specified period
        Since:
        4.2.0
      • getPurgeJobIdList

        public List<Long> getPurgeJobIdList​(int fetchLimit)
        Return the list of Job ID to purge.
        Parameters:
        fetchLimit - the query fetch limit
        Returns:
        the list of Job ID to purge
        Since:
        4.3.3
      • recalcJobPurgeTime

        public void recalcJobPurgeTime​(int maxAgeInDays)
        Recalculate job purge times if the global purge policy has changed.
        Parameters:
        maxAgeInDays - the new maximum age of a collaboration job
        Since:
        4.3.3
      • updateJobPurgeTime

        public void updateJobPurgeTime​(Job job)
        Updates the job purge time based on the job status. Note that if the job is finished (completed, cancelled, expired), the finished time should be set for purge time calculation.
        Parameters:
        job - the job (required)
        Since:
        4.3.3
      • getFinishedJobCount

        public int getFinishedJobCount()
        Return the number of finished collaboration jobs
        Returns:
        the number of finished collaboration jobs
        Since:
        4.3.3
      • getJobsForLicensing

        public org.apache.cayenne.ResultIterator<Job> getJobsForLicensing()
        Return up to 100,000 collaboration jobs that have not yet been published for licensing
        Returns:
        a result iterator for matching jobs
        Since:
        4.3.4