Package com.avoka.tm.query
Class RoleQuery
java.lang.Object
com.avoka.tm.query.RoleQuery
Provides a role query class.
Examples
Please find the Role query examples about list, get first and count below.
Role Query List Example
This Groovy example shows how to list roles matching certain criteria ordered ascending by name (maximum number of 4 records).
import com.avoka.tm.query.* import com.avoka.tm.vo.* List<Role> roles = new RoleQuery() .setFetchLimit(4) .addOrderByAsc("name") .listValues() // In JSON format String rolesJson = new RoleQuery() .setFetchLimit(4) .addOrderByAsc("name") .listJson()
Role Query First Example
This Groovy example shows how to get first role matching certain criteria ordered descending by id.
import com.avoka.tm.query.* import com.avoka.tm.vo.* Role role = new RoleQuery() .setName(roleName) .firstValue() // In JSON format String roleJson = new RoleQuery() .setName(roleName) .firstJson()
- Since:
- 19.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 role JSON value.Execute the query and return the first role value object for the query.listJson()
Execute the query and return a role JSON array list.Execute the role query and return a list of Role value objects.setFetchLimit
(int fetchLimit) Set the query fetch limit to limit the maximum number of records returned.Set the role id (PK) query parameter.Set the role name query parameter.
-
Constructor Details
-
RoleQuery
-
-
Method Details
-
setId
Set the role id (PK) query parameter.- Parameters:
id
- the role id (PK) query parameter- Returns:
- the role query
-
setName
Set the role name query parameter.- Parameters:
name
- the role name query parameter- Returns:
- the role 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 role query
-
addOrderByAsc
Add the sort order by ascending to the query.- Parameters:
orderProperty
- the property to sort by (required)- Returns:
- the role query
-
addOrderByDesc
Add the sort order by descending to the query.- Parameters:
orderProperty
- the property to sort by (required)- Returns:
- the role 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 role query and return a list of Role value objects.- Returns:
- execute the role query and return a list of Role value objects
-
listJson
Execute the query and return a role JSON array list.- Returns:
- execute the query and return a role JSON array list
-
firstValue
Execute the query and return the first role value object for the query.- Returns:
- execute the query and return the first role value object for the query
-
firstJson
Execute the query and return the first role JSON value.- Returns:
- execute the query and return the first role JSON value
-