Package com.avoka.tm.query
Class ClientQuery
java.lang.Object
com.avoka.tm.query.ClientQuery
Provides a client value object query class.
Examples
Please find the client query examples of listValues and listJson below.
Client Query List Example
This Groovy example shows how to list clients sorted by name, with the result set limited to a maximum of 50 records.
import com.avoka.tm.query.* import com.avoka.tm.vo.* List<Client> clients = new ClientQuery() .addOrderByAsc("name") .setFetchLimit(50) .listValues() // In JSON format String clientsJson = new ClientQuery() .addOrderByAsc("name") .setFetchLimit(50) .listJson()
Client Query First Example
This Groovy example shows how to get first client matching certain criteria.
import com.avoka.tm.query.* import com.avoka.tm.vo.* Client client = new ClientQuery() .setId(1L) .firstValue() //By name criteria Client client = new ClientQuery() .setName("testName") .firstValue()
Client Query Count Example
This Groovy example shows how to count all clients.
import com.avoka.tm.query.* int clientCount = new ClientQuery() .count()
- Since:
- 22.10.4
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddOrderByAsc
(String orderProperty) Add the sort order by ascending to the query.addOrderByDesc
(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.Execute the query and return the first client JSON value.Execute the query and return the first client value object for the query.listJson()
Execute the query and return a client JSON array list.Execute the client query and return a list of client value objects.Set the client code query parameter.setFetchLimit
(int fetchLimit) Set the query fetch limit to limit the maximum number of records returned.Set the client id (PK) query parameter.Set the client key query parameter.Set the client name query parameter.
-
Constructor Details
-
ClientQuery
-
-
Method Details
-
setId
Set the client id (PK) query parameter.- Parameters:
id
- the client id (PK) query parameter- Returns:
- the client query
-
setCode
Set the client code query parameter.- Parameters:
code
- the client code query parameter- Returns:
- the client query
-
setKey
Set the client key query parameter.- Parameters:
key
- the client key query parameter- Returns:
- the client query
-
setName
Set the client name query parameter.- Parameters:
name
- the client name query parameter- Returns:
- the client query
-
setFetchLimit
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 client query
-
addOrderByAsc
Add the sort order by ascending to the query.- Parameters:
orderProperty
- the property to sort by (required)- Returns:
- the client query
-
addOrderByDesc
Add the sort order by descending to the query.- Parameters:
orderProperty
- the property to sort by (required)- Returns:
- the client 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
Execute the client query and return a list of client value objects.- Returns:
- execute the client query and return a list of client value objects
-
listJson
Execute the query and return a client JSON array list.- Returns:
- execute the query and return a client JSON array list
-
firstValue
Execute the query and return the first client value object for the query.- Returns:
- execute the query and return the first client value object for the query
-
firstJson
Execute the query and return the first client JSON value.- Returns:
- execute the query and return the first client JSON value
-