Class JobQuery


  • public class JobQuery
    extends Object

    Provides a job value object query class.

    Examples

    Please find the job query examples about list, get first and count below.

    Job Query List Example

    This Groovy example shows how to list jobs matching certain criteria ordered descending by id (maximum number of 4 records).

     import com.avoka.tm.query.*
     import com.avoka.tm.vo.*
    
     String jobName = "job name..."
    
     List<Job> jobs = new JobQuery()
         .setName(jobName)
         .setStatus(Job.STATUS_IN_PROGRESS)
         .addOrderByDesc("timeLastProcessed")
         .setFetchLimit(100)
         .listValues()
    
     // In JSON format
     String jobsJson = new JobQuery()
         .setName(jobName)
         .setStatus(Job.STATUS_IN_PROGRESS)
         .addOrderBy("timeLastProcessed", true)
         .setFetchLimit(100)
         .listJson() 

    Job Query First Example

    This Groovy example shows how to get first job matching certain criteria ordered descending by id.

     import com.avoka.tm.query.*
     import com.avoka.tm.vo.*
    
     Job job = new JobQuery()
         .setName(jobName)
         .addOrderByDesc("id")
         .firstValue()
    
     // In JSON format
     String jobJson = new JobQuery()
         .setName(jobName)
         .setStatus(Job.STATUS_COMPLETED)
         .firstJson() 

    Job Query Count Example

    This Groovy example shows how to count all jobs matching certain criteria.

     import com.avoka.tm.query.*
     import com.avoka.tm.vo.*
    
     int jobInStatusCount = new JobQuery()
         .setStatus(Job.STATUS_IN_PROGRESS)
         .count() 
    Since:
    5.0.0
    See Also:
    Job
    • Constructor Detail

      • JobQuery

        public JobQuery()
    • Method Detail

      • setId

        public JobQuery setId​(Long id)
        Set the job id (PK) query parameter.
        Parameters:
        id - the job id (PK) query parameter
        Returns:
        the job query
      • setJobStepId

        public JobQuery setJobStepId​(Long jobStepId)
        Set the job step id query parameter.
        Parameters:
        jobStepId - the job step id (PK) query parameter
        Returns:
        the job query
        Since:
        19.5.0
      • setJobStep

        public JobQuery setJobStep​(com.avoka.fc.core.entity.JobStep jobStep)
        Set the job step query parameter.
        Parameters:
        jobStep - the job step query parameter
        Returns:
        the job query
        Since:
        19.5.0
      • setJobActionId

        public JobQuery setJobActionId​(Long jobActionId)
        Set the job action id query parameter.
        Parameters:
        jobActionId - the job action id (PK) query parameter
        Returns:
        the job query
        Since:
        19.5.0
      • setJobAction

        public JobQuery setJobAction​(com.avoka.fc.core.entity.JobAction jobAction)
        Set the job action query parameter.
        Parameters:
        jobAction - the job action query parameter
        Returns:
        the job query
        Since:
        19.5.0
      • setName

        public JobQuery setName​(String name)
        Set the job name query parameter. If the name parameter include % then perform a like name query, otherwise perform an exact name match.
        Parameters:
        name - the job name query parameter
        Returns:
        the job query
      • setJobKey

        public JobQuery setJobKey​(String jobKey)
        Set the job key query parameter.
        Parameters:
        jobKey - the job key query parameter
        Returns:
        the job query
      • setStatus

        public JobQuery setStatus​(String status)
        Set the job status query parameter.
        Parameters:
        status - the job status query parameter
        Returns:
        the job query
      • setReferenceNumber

        public JobQuery setReferenceNumber​(String referenceNumber)
        Set the job reference number query parameter.
        Parameters:
        referenceNumber - the job reference number query parameter
        Returns:
        the job query
      • setUserLoginName

        public JobQuery setUserLoginName​(String userLoginName)
        Set the job transaction user's login name (username).
        Parameters:
        userLoginName - the job transaction user's login name (username).
        Returns:
        the job query
        Since:
        18.11.0
      • addGroup

        public JobQuery addGroup​(String groupName)
        Add the group name to the job query so that only jobs belonging to the job group are included. Filtering on multiple groups is supported.
        Parameters:
        groupName - the group name to query parameter
        Returns:
        the job query
        Since:
        17.10.0
      • hasProperty

        public JobQuery hasProperty​(String name)
        Set job property name parameter.
        Parameters:
        name - the property name query parameter
        Returns:
        the job query
        Since:
        17.10.0
      • hasPropertyValue

        public JobQuery hasPropertyValue​(String value)
        Set job property value parameter.
        Parameters:
        value - the property value query parameter
        Returns:
        the job query
        Since:
        17.10.0
      • hasNoProperty

        public JobQuery hasNoProperty​(String name)
        Set has not job property name query filter parameter.
        Parameters:
        name - the has not property name query parameter
        Returns:
        the job query
        Since:
        17.10.0
      • hasPropertyNameValue

        public JobQuery hasPropertyNameValue​(String name,
                                             String value)
        Set property name/value parameter.
        Parameters:
        name - the property name query parameter
        value - the property value query parameter
        Returns:
        the job query
        Since:
        19.05
      • setStartDate

        public JobQuery setStartDate​(Date date)
        Set the job create time start date filter, where jobs must have been created at or after the specified date.
        Parameters:
        date - the job creation time start date filter
        Returns:
        the job query
        Since:
        17.10.0
      • setEndDate

        public JobQuery setEndDate​(Date date)
        Set the job create time end date filter, where jobs must have been created before the specified date.
        Parameters:
        date - the job creation time end date filter
        Returns:
        the job query
        Since:
        17.10.0
      • setFetchLimit

        public JobQuery setFetchLimit​(int fetchLimit)
        Set the query fetch limit to limit the maximum number of records returned. The default query fetch limit is 100 records.
        Parameters:
        fetchLimit - the query fetch limit
        Returns:
        the job query
      • addOrderByAsc

        public JobQuery addOrderByAsc​(String orderProperty)
        Add the sort order by ascending to the query.
        Parameters:
        orderProperty - the property to sort by (required)
        Returns:
        the job query
      • addOrderByDesc

        public JobQuery addOrderByDesc​(String orderProperty)
        Add the sort order by descending to the query.
        Parameters:
        orderProperty - the property to sort by (required)
        Returns:
        the job query
      • count

        public int count()
        Execute a select count query and return the total number of records selected by the query.
        Returns:
        the total number of records selected by the query
      • listValues

        public List<Job> listValues()
        Execute the job query and return a list of Job value objects.
        Returns:
        execute the job query and return a list of Job value objects
      • listJson

        public String listJson()
        Execute the query and return an jobs JSON array list.
        Returns:
        execute the query and return an jobs JSON array list
      • firstValue

        public Job firstValue()
        Execute the query and return the first job value object for the query.
        Returns:
        execute the query and return the first job value object for the query
      • firstJson

        public String firstJson()
        Execute the query and return the first job JSON value.
        Returns:
        execute the query and return the first job JSON value