Package com.avoka.tm.query
Class JobQuery
- java.lang.Object
-
- com.avoka.tm.query.JobQuery
-
public class JobQuery extends java.lang.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 Summary
Constructors Constructor Description JobQuery()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JobQuery
addGroup(java.lang.String groupName)
Add the group name to the job query so that only jobs belonging to the job group are included.JobQuery
addOrderByAsc(java.lang.String orderProperty)
Add the sort order by ascending to the query.JobQuery
addOrderByDesc(java.lang.String orderProperty)
Add the sort order by descending to the query.int
count()
Execute a select count query and return the total number of records selected by the query.java.lang.String
firstJson()
Execute the query and return the first job JSON value.Job
firstValue()
Execute the query and return the first job value object for the query.JobQuery
hasNoProperty(java.lang.String name)
Set has not job property name query filter parameter.JobQuery
hasProperty(java.lang.String name)
Set job property name parameter.java.lang.String
listJson()
Execute the query and return an jobs JSON array list.java.util.List<Job>
listValues()
Execute the job query and return a list of Job value objects.JobQuery
setEndDate(java.util.Date date)
Set the job create time end date filter, where jobs must have been created before the specified date.JobQuery
setFetchLimit(int fetchLimit)
Set the query fetch limit to limit the maximum number of records returned.JobQuery
setId(java.lang.Long id)
Set the job id (PK) query parameter.JobQuery
setJobKey(java.lang.String jobKey)
Set the job key query parameter.JobQuery
setName(java.lang.String name)
Set the job name query parameter.JobQuery
setReferenceNumber(java.lang.String referenceNumber)
Set the job reference number query parameter.JobQuery
setStartDate(java.util.Date date)
Set the job create time start date filter, where jobs must have been created at or after the specified date.JobQuery
setStatus(java.lang.String status)
Set the job status query parameter.JobQuery
setUserLoginName(java.lang.String userLoginName)
Set the job transaction user's login name (username).
-
-
-
Method Detail
-
setId
public JobQuery setId(java.lang.Long id)
Set the job id (PK) query parameter.- Parameters:
id
- the job id (PK) query parameter- Returns:
- the job query
-
setName
public JobQuery setName(java.lang.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(java.lang.String jobKey)
Set the job key query parameter.- Parameters:
jobKey
- the job key query parameter- Returns:
- the job query
-
setStatus
public JobQuery setStatus(java.lang.String status)
Set the job status query parameter.- Parameters:
status
- the job status query parameter- Returns:
- the job query
-
setReferenceNumber
public JobQuery setReferenceNumber(java.lang.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(java.lang.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(java.lang.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(java.lang.String name)
Set job property name parameter.- Parameters:
name
- the property name query parameter- Returns:
- the job query
- Since:
- 17.10.0
-
hasNoProperty
public JobQuery hasNoProperty(java.lang.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
-
setStartDate
public JobQuery setStartDate(java.util.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(java.util.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(java.lang.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(java.lang.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 java.util.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 java.lang.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 java.lang.String firstJson()
Execute the query and return the first job JSON value.- Returns:
- execute the query and return the first job JSON value
-
-