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:
- 23.4.0
- See Also:
- 
Constructor SummaryConstructors
- 
Method SummaryModifier 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.intcount()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- 
setIdSet the client id (PK) query parameter.- Parameters:
- id- the client id (PK) query parameter
- Returns:
- the client query
 
- 
setCodeSet the client code query parameter.- Parameters:
- code- the client code query parameter
- Returns:
- the client query
 
- 
setKeySet the client key query parameter.- Parameters:
- key- the client key query parameter
- Returns:
- the client query
 
- 
setNameSet the client name query parameter.- Parameters:
- name- the client name query parameter
- Returns:
- the client query
 
- 
setFetchLimitSet 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
 
- 
addOrderByAscAdd the sort order by ascending to the query.- Parameters:
- orderProperty- the property to sort by (required)
- Returns:
- the client query
 
- 
addOrderByDescAdd the sort order by descending to the query.- Parameters:
- orderProperty- the property to sort by (required)
- Returns:
- the client query
 
- 
countpublic 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
 
- 
listValuesExecute the client query and return a list of client value objects.- Returns:
- execute the client query and return a list of client value objects
 
- 
listJsonExecute the query and return a client JSON array list.- Returns:
- execute the query and return a client JSON array list
 
- 
firstValueExecute 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
 
- 
firstJsonExecute the query and return the first client JSON value.- Returns:
- execute the query and return the first client JSON value
 
 
-