Class CategoryQuery
Provides a category value object query class.
Examples
Please find the category query examples of listValues and listJson below.
Category Query List Example
This Groovy example shows how to list categories 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
categories = new CategoryQuery() .addOrderByAsc("name") .setFetchLimit(50) .listValues() // In JSON format String json = new CategoryQuery() .addOrderByAsc("name") .setFetchLimit(50) .listJson()
Category Query First Example
This Groovy example shows how to get first category matching certain criteria.
import com.avoka.tm.query.* import com.avoka.tm.vo.*Category category = new CategoryQuery() .setId(1L) .firstValue()
//By name criteria Category category = new CategoryQuery() .setName("testName") .firstValue()
Category count query Example
This Groovy example shows how to count all categories.
import com.avoka.tm.query.*int count = new CategoryQuery() .count()
- Since:
- 23.11.0
- 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 category value object for the query.listJson()
Execute the query and return a category JSON array list.Execute the category query and return a list of category value objects.setClientCode
(String clientCode) set the category client code query parameter.setFetchLimit
(int fetchLimit) Set the query fetch limit to limit the maximum number of records returned.Set the category id (PK) query parameter.Set the name parameter.
-
Constructor Details
-
CategoryQuery
-
-
Method Details
-
setId
Set the category id (PK) query parameter.- Parameters:
id
- the category id (PK) query parameter- Returns:
- the category query
-
setName
Set the name parameter.- Parameters:
name
- the category name query parameter- Returns:
- the category query
-
setClientCode
set the category client code query parameter.- Parameters:
clientCode
- the category client code query parameter- Returns:
- the category 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 category query
-
addOrderByAsc
Add the sort order by ascending to the query.- Parameters:
orderProperty
- the property to sort by (required)- Returns:
- the category query
-
addOrderByDesc
Add the sort order by descending to the query.- Parameters:
orderProperty
- the property to sort by (required)- Returns:
- the category query
-
count
public int count()Execute a select count query and return the total number of records selected by the query.- Returns:
- Execute a select count query and return the total number of records selected by the query.
-
listValues
Execute the category query and return a list of category value objects.- Returns:
- Execute the category query and return a list of category value objects.
-
listJson
Execute the query and return a category JSON array list.- Returns:
- execute the query and return a category JSON array list.
-
firstValue
Execute the query and return the first category value object for the query.- Returns:
- execute the query and return the first category value object for the query.
-