Package com.avoka.tm.query
Class UserQuery
- java.lang.Object
-
- com.avoka.tm.query.UserQuery
-
public class UserQuery extends Object
Provides a user value object query class.
Examples
Please find the user query examples about list, get first and count below.
User Query List Example
This Groovy example shows how to list active users sorted by first name and last name, with the result set limited to a maximum of 50 records.
import com.avoka.tm.query.* import com.avoka.tm.vo.* List<User> users = new UserQuery() .setAccountStatus(User.STATUS_ACTIVE) .addOrderByAsc("firstName") .addOrderByAsc("lastName") .setFetchLimit(50) .listValues() // In JSON format String usersJson = new UserQuery() .setAccountStatus(User.STATUS_ACTIVE) .addOrderByAsc("firstName") .addOrderByAsc("lastName") .setFetchLimit(50) .listJson()
User Query First Example
This Groovy example shows how to get first user matching certain criteria.
import com.avoka.tm.query.* import com.avoka.tm.vo.* User userJohn = new UserQuery() .setFirstName("John") .firstValue()
User Query Count Example
This Groovy example shows how to count all users which have an inactive status.
import com.avoka.tm.query.* int inactiveCount = new UserQuery() .setAccountStatus(User.STATUS_INACTIVE) .count()
- Since:
- 5.0.0
-
-
Constructor Summary
Constructors Constructor Description UserQuery()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description UserQuery
addGroup(String groupName)
Add the group name to the user query so that only users belonging to the group are included.UserQuery
addOrderByAsc(String orderProperty)
Add the sort order by ascending to the query.UserQuery
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.String
firstJson()
Execute the query and return the first user JSON value.User
firstValue()
Execute the query and return the first user value object for the query.String
listJson()
Execute the query and return an users JSON array list.List<User>
listValues()
Execute the user query and return a list of User value objects.UserQuery
setAccountStatus(String accountStatus)
Set the user account status [ Active | Inactive | Locked | Locked Temporarily | Pending | Rejected ] query parameter.UserQuery
setClientCode(String clientCode)
Set the user organization client code query parameter.UserQuery
setEmail(String email)
Set the user email query parameter.UserQuery
setFetchLimit(int fetchLimit)
Set the query fetch limit to limit the maximum number of records returned.UserQuery
setFirstName(String firstName)
Set the user first name query parameter.UserQuery
setGlobalAccess(boolean hasGlobalAccess)
Set the user has administrative global organization access.UserQuery
setId(Long id)
Set the user id (PK) query parameter.UserQuery
setLastName(String lastName)
Set the user last name query parameter.UserQuery
setLoginName(String loginName)
Set the user login name query parameter.UserQuery
setMobile(String mobile)
Set the user mobile number query parameter.UserQuery
setUserKey(String userKey)
Set the user key query parameter.UserQuery
setUserType(String userType)
Set the user type [ Local | LDAP | SSO ] query parameter.
-
-
-
Method Detail
-
setId
public UserQuery setId(Long id)
Set the user id (PK) query parameter.- Parameters:
id
- the user id (PK) query parameter- Returns:
- the user query
-
setLoginName
public UserQuery setLoginName(String loginName)
Set the user login name query parameter.- Parameters:
loginName
- the user login name query parameter- Returns:
- the user query
-
setAccountStatus
public UserQuery setAccountStatus(String accountStatus)
Set the user account status [ Active | Inactive | Locked | Locked Temporarily | Pending | Rejected ] query parameter.- Parameters:
accountStatus
- the user account status [ Active | Inactive | Locked | Locked Temporarily | Pending | Rejected ] query parameter- Returns:
- the user query
-
setEmail
public UserQuery setEmail(String email)
Set the user email query parameter.- Parameters:
email
- the user email query parameter- Returns:
- the user query
-
setFirstName
public UserQuery setFirstName(String firstName)
Set the user first name query parameter.- Parameters:
firstName
- the user first name query parameter- Returns:
- the user query
-
setLastName
public UserQuery setLastName(String lastName)
Set the user last name query parameter.- Parameters:
lastName
- the user last name query parameter- Returns:
- the user query
-
setMobile
public UserQuery setMobile(String mobile)
Set the user mobile number query parameter.- Parameters:
mobile
- the user mobile number query parameter- Returns:
- the user query
-
setClientCode
public UserQuery setClientCode(String clientCode)
Set the user organization client code query parameter.- Parameters:
clientCode
- the user client organization code query parameter- Returns:
- the user query
-
setUserKey
public UserQuery setUserKey(String userKey)
Set the user key query parameter.- Parameters:
userKey
- the user key query parameter- Returns:
- the user query
-
setUserType
public UserQuery setUserType(String userType)
Set the user type [ Local | LDAP | SSO ] query parameter.- Parameters:
userType
- the user type [ Local | LDAP | SSO ] query parameter- Returns:
- the user query
-
addGroup
public UserQuery addGroup(String groupName)
Add the group name to the user query so that only users belonging to the group are included. Filtering on multiple groups is supported.- Parameters:
groupName
- the group name to query parameter- Returns:
- the user query
- Since:
- 18.11.0
-
setGlobalAccess
public UserQuery setGlobalAccess(boolean hasGlobalAccess)
Set the user has administrative global organization access.- Parameters:
hasGlobalAccess
- the user has administrative global organization access- Returns:
- the user query
-
setFetchLimit
public UserQuery 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 user query
-
addOrderByAsc
public UserQuery addOrderByAsc(String orderProperty)
Add the sort order by ascending to the query.- Parameters:
orderProperty
- the property to sort by (required)- Returns:
- the user query
-
addOrderByDesc
public UserQuery addOrderByDesc(String orderProperty)
Add the sort order by descending to the query.- Parameters:
orderProperty
- the property to sort by (required)- Returns:
- the user 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 List<User> listValues()
Execute the user query and return a list of User value objects.- Returns:
- execute the user query and return a list of User value objects
-
listJson
public String listJson()
Execute the query and return an users JSON array list.- Returns:
- execute the query and return an users JSON array list
-
firstValue
public User firstValue()
Execute the query and return the first user value object for the query.- Returns:
- execute the query and return the first user value object for the query
-
firstJson
public String firstJson()
Execute the query and return the first user JSON value.- Returns:
- execute the query and return the first user JSON value
-
-