Class UserQuery
public class UserQuery
extends java.lang.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
ConstructorsConstructor | Description |
---|---|
UserQuery() |
Method Summary
All Methods Instance Methods Concrete MethodsModifier and Type | Method | Description |
---|---|---|
UserQuery |
addGroup(java.lang.String groupName) |
Add the group name to the user query so that only users belonging to the group are included. |
UserQuery |
addOrderByAsc(java.lang.String orderProperty) |
Add the sort order by ascending to the query. |
UserQuery |
addOrderByDesc(java.lang.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. |
java.lang.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. |
java.lang.String |
listJson() |
Execute the query and return an users JSON array list. |
java.util.List<User> |
listValues() |
Execute the user query and return a list of User value objects. |
UserQuery |
setAccountStatus(java.lang.String accountStatus) |
Set the user account status [ Active | Inactive | Locked | Locked Temporarily | Pending | Rejected ] query parameter. |
UserQuery |
setClientCode(java.lang.String clientCode) |
Set the user organization client code query parameter. |
UserQuery |
setEmail(java.lang.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(java.lang.String firstName) |
Set the user first name query parameter. |
UserQuery |
setGlobalAccess(boolean hasGlobalAccess) |
Set the user has administrative global organization access. |
UserQuery |
setId(java.lang.Long id) |
Set the user id (PK) query parameter. |
UserQuery |
setLastName(java.lang.String lastName) |
Set the user last name query parameter. |
UserQuery |
setLoginName(java.lang.String loginName) |
Set the user login name query parameter. |
UserQuery |
setMobile(java.lang.String mobile) |
Set the user mobile number query parameter. |
UserQuery |
setUserKey(java.lang.String userKey) |
Set the user key query parameter. |
UserQuery |
setUserType(java.lang.String userType) |
Set the user type [ Local | LDAP | SSO ] query parameter. |
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString,
wait, wait, wait
Constructor Detail
UserQuery
public UserQuery()
Method Detail
setId
public UserQuery setId(java.lang.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(java.lang.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(java.lang.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(java.lang.String email)
Set the user email query parameter.
- Parameters:
email
- the user email query parameter- Returns:
- the user query
setFirstName
public UserQuery setFirstName(java.lang.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(java.lang.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(java.lang.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(java.lang.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(java.lang.String userKey)
Set the user key query parameter.
- Parameters:
userKey
- the user key query parameter- Returns:
- the user query
setUserType
public UserQuery setUserType(java.lang.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(java.lang.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(java.lang.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(java.lang.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 java.util.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 java.lang.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 java.lang.String firstJson()
Execute the query and return the first user JSON value.
- Returns:
- execute the query and return the first user JSON value