Class UserQuery
- java.lang.Object
-
- ch.ivyteam.ivy.persistence.query.Query<IUser>
-
- ch.ivyteam.ivy.security.query.UserQuery
-
- Direct Known Subclasses:
UserQuery.FilterLink
,UserQuery.GroupByQuery
,UserQuery.OrderByQuery
@Generated(value="ch.ivyteam.db.meta.generator.internal.query.JavaQueryClassGenerator", date="Jul 29, 2022, 2:23:57 PM") public class UserQuery extends Query<IUser>
Provides a query builder to query
user
data of thecurrent security context
.To execute the query use
IUserQueryExecutor
. Seeivy.wf.getSecurityContext().users().queryExecutor()
Example how to filter and order data:
import ch.ivyteam.ivy.security.query.UserQuery; import ch.ivyteam.ivy.security.IUser; import ch.ivyteam.ivy.security.IRole; IRole manager = ivy.wf.getSecurityContext().findRole("manager"); UserQuery userQuery = UserQuery.create(); List<IUser> users = userQuery.where().hasRole(manager) .orderBy().name().ascending() .executor().results();
Note, that a UserQuery by default returns only users of the
current security context
. It is not necessary to explicit filter the users withUserQuery.IFilterableColumns.applicationId()
as this is already implicitly done by the UserQuery itself.- API:
- This is a public API.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
UserQuery.FilterLink
Links a where condition with another.static class
UserQuery.FilterQuery
Provides filter functionality forIUser
static class
UserQuery.GroupByQuery
Provides methods to group the result by certain fields.static interface
UserQuery.IBoolFilterQuery
static interface
UserQuery.IColumnFilterQuery
Basic filter functionality provider for a column ofIUser
static interface
UserQuery.IFilterableColumns
Provides filter functionality forIUser
static interface
UserQuery.IFilterLink
Links a where condition with another.static interface
UserQuery.IFilterQuery
Provides filter functionality forIUser
static interface
UserQuery.IGroupByQueryColumns
Provides methods to group the result by certain fields.static interface
UserQuery.IIntegerColumnFilterQuery
Provides filter functionality for an integer column ofIUser
static interface
UserQuery.INumberColumnFilterQuery
Provides filter functionality for a decimal number column ofIUser
static interface
UserQuery.IOrderByQueryColumns
Provides methods to order the result by columns ofIUser
.static interface
UserQuery.IPatternColumnFilterQuery
Provides filter functionality for columns ofIUser
that can be filter by string patterns (isLike)static interface
UserQuery.IStringColumnFilterQuery
Provides filter functionality for a string column ofIUser
static class
UserQuery.OrderByColumnQuery
Provides methods to define the direction of the sorting either ascending or descending.static class
UserQuery.OrderByQuery
Provides methods to order the result by columns ofIUser
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static UserQuery
create()
Creates a new queryIFluentQueryExecutor<IUser>
executor()
Provides a fluent API to execute this query and fetch its results.UserQuery.IGroupByQueryColumns
groupBy()
Returns an object which contains the group by part for this query.
It provides methods to group the result by certain fields.UserQuery.IOrderByQueryColumns
orderBy()
Returns an object which contains the order by part for this query.
It provides methods to order the result by certain columns.UserQuery.IFilterQuery
where()
Returns an object which contains the where part for this query.
It provides methods to filter the result by certain columns.
-
-
-
Method Detail
-
create
public static UserQuery create()
Creates a new query- Returns:
- A new instance of UserQuery
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
executor
public IFluentQueryExecutor<IUser> executor()
Provides a fluent API to execute this query and fetch its results.
- Returns:
- fluent API to execute this query.
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
groupBy
public UserQuery.IGroupByQueryColumns groupBy()
Returns an object which contains the group by part for this query.
It provides methods to group the result by certain fields.Example:
Corresponds to SQL:UserQuery.create().groupBy().name();
SELECT Name FROM IWA_User GROUP BY Name
- Returns:
- A query group by builder to add group by statements
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
orderBy
public UserQuery.IOrderByQueryColumns orderBy()
Returns an object which contains the order by part for this query.
It provides methods to order the result by certain columns.- Returns:
- An order by query builder to add order by statements
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
where
public UserQuery.IFilterQuery where()
Returns an object which contains the where part for this query.
It provides methods to filter the result by certain columns.- Returns:
- An filter query builder to add where statements
- API:
- This public API is available in IvyScript and Java. It has the visibility EXPERT.
-
-