Class EntityQuery<T>

java.lang.Object
com.atlassian.crowd.search.query.entity.EntityQuery<T>
All Implemented Interfaces:
Query<T>
Direct Known Subclasses:
AliasQuery, ApplicationQuery, AuthenticatedTokenQuery, DirectoryQuery, GroupQuery, TokenQuery, UserQuery

public abstract class EntityQuery<T> extends Object implements Query<T>
  • Field Details

    • MAX_MAX_RESULTS

      public static final int MAX_MAX_RESULTS
      This is the recommended maximum number of 'max' results the system will allow you to return. This value is NOT enforced. ApplicationServiceGeneric often retrieves (startIndex + maxResults) number of results which breaks this MAX_MAX_RESULTS.
      See Also:
    • ALL_RESULTS

      public static final int ALL_RESULTS
      Flag to indicate that an EntityQuery should retrieve all results.

      WARNING: using this flag could retrieve thousands or millions of entities. Misuse can cause massive performance problems. This flag should only ever be used in exceptional circumstances.

      If you need to find "all" entities, then consider making multiple successive calls to Crowd to receive partial results. That way, the entire result set is never stored in memory on the Crowd server at any one time.

      See Also:
  • Constructor Details

  • Method Details

    • getEntityDescriptor

      public EntityDescriptor getEntityDescriptor()
    • getSearchRestriction

      public SearchRestriction getSearchRestriction()
      Description copied from interface: Query
      Restrictions to apply to the query. Typically finding users of a given name, etc.
      Specified by:
      getSearchRestriction in interface Query<T>
      Returns:
      the search restriction to apply to this query.
    • getStartIndex

      public int getStartIndex()
      Description copied from interface: Query
      The index of the first element to return.
      Specified by:
      getStartIndex in interface Query<T>
      Returns:
      a positive index value.
    • getMaxResults

      public int getMaxResults()
      Description copied from interface: Query
      The maximum number of elements to return.
      Specified by:
      getMaxResults in interface Query<T>
      Returns:
      a number of elements.
    • getReturnType

      public Class<T> getReturnType()
      Description copied from interface: Query
      The type of elements to return.
      Specified by:
      getReturnType in interface Query<T>
      Returns:
      the expected type of elements to be returned by the search.
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • addToMaxResults

      public static int addToMaxResults(int maxResults, int add)
      Simple utility method that increases or decreases the result limit and deals with ALL_RESULTS, overflow and prevents negative values.
    • allResultsToLongMax

      public static long allResultsToLongMax(int maxResults)
      Converts max results limit to long value - replaces ALL_RESULTS with Long.MAX_VALUE}.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • withReturnType

      public <Q> EntityQuery<Q> withReturnType(Class<Q> returnType)
    • withStartIndex

      public EntityQuery<T> withStartIndex(int startIndex)
    • withMaxResults

      public EntityQuery<T> withMaxResults(int maxResults)
    • withStartIndexAndMaxResults

      public EntityQuery<T> withStartIndexAndMaxResults(int startIndex, int maxResults)
    • withSearchRestriction

      public EntityQuery<T> withSearchRestriction(SearchRestriction searchRestriction)
    • baseSplitQuery

      public EntityQuery<T> baseSplitQuery()
      Returns:
      query with adjusted start index and maximum results which is required for merging query results
    • splitOrRestrictionIfNeeded

      public Optional<List<EntityQuery<T>>> splitOrRestrictionIfNeeded(int maxSize)
      Splits the query if needed. Query is split if the number of OR conditions is higher than maxSize. Only top level condition split is supported. Note that the start index and max conditions are adjusted.
      Returns:
      split queries if split is needed or Optional#empty otherwise
    • withAllResults

      public EntityQuery<T> withAllResults()
    • addToMaxResults

      public EntityQuery<T> addToMaxResults(int add)
    • hasAllResults

      public boolean hasAllResults()