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("ch.ivyteam.db.meta.generator.internal.query.JavaQueryClassGenerator") public class UserQuery extends Query<IUser>
Fluent API to query IUser.

Provides a query builder to query user data of the current security context.

To execute the query use IUserQueryExecutor. See ivy.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 with UserQuery.IFilterableColumns.securitySystemId() as this is already implicitly done by the UserQuery itself.

API:
This is a public API.
  • Method Details

    • create

      public static UserQuery create()
      Creates a new query
      Returns:
      A new instance of UserQuery
      API:
      This public API is available in Java.
    • 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 Java.
    • groupBy

      Returns an object which contains the group by part for this query.
      It provides methods to group the result by certain fields.

      Example:

      UserQuery.create().groupBy().name();
      Corresponds to SQL:
      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 Java.
    • 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 Java.
    • 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 Java.