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
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final int
Flag to indicate that an EntityQuery should retrieve all results.static final int
This is the recommended maximum number of 'max' results the system will allow you to return. -
Constructor Summary
ConstructorsConstructorDescriptionEntityQuery
(EntityQuery<T> query, int startIndex, int maxResults) EntityQuery
(EntityQuery query, Class<T> returnType) EntityQuery
(Class<T> returnType, EntityDescriptor entityDescriptor, SearchRestriction searchRestriction, int startIndex, int maxResults) -
Method Summary
Modifier and TypeMethodDescriptionaddToMaxResults
(int add) static int
addToMaxResults
(int maxResults, int add) Simple utility method that increases or decreases the result limit and deals withALL_RESULTS
, overflow and prevents negative values.static long
allResultsToLongMax
(int maxResults) Converts max results limit to long value - replacesALL_RESULTS
withLong.MAX_VALUE
}.boolean
int
The maximum number of elements to return.The type of elements to return.Restrictions to apply to the query.int
The index of the first element to return.boolean
int
hashCode()
Optional<List<EntityQuery<T>>>
splitOrRestrictionIfNeeded
(int maxSize) Splits the query if needed.toString()
withMaxResults
(int maxResults) <Q> EntityQuery<Q>
withReturnType
(Class<Q> returnType) withSearchRestriction
(SearchRestriction searchRestriction) withStartIndex
(int startIndex) withStartIndexAndMaxResults
(int startIndex, int maxResults)
-
Field Details
-
MAX_MAX_RESULTS
public static final int MAX_MAX_RESULTSThis 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_RESULTSFlag 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
-
EntityQuery
public EntityQuery(Class<T> returnType, EntityDescriptor entityDescriptor, SearchRestriction searchRestriction, int startIndex, int maxResults) -
EntityQuery
-
EntityQuery
-
-
Method Details
-
getEntityDescriptor
-
getSearchRestriction
Description copied from interface:Query
Restrictions to apply to the query. Typically finding users of a given name, etc.- Specified by:
getSearchRestriction
in interfaceQuery<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 interfaceQuery<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 interfaceQuery<T>
- Returns:
- a number of elements.
-
getReturnType
Description copied from interface:Query
The type of elements to return.- Specified by:
getReturnType
in interfaceQuery<T>
- Returns:
- the expected type of elements to be returned by the search.
-
equals
-
addToMaxResults
public static int addToMaxResults(int maxResults, int add) Simple utility method that increases or decreases the result limit and deals withALL_RESULTS
, overflow and prevents negative values. -
allResultsToLongMax
public static long allResultsToLongMax(int maxResults) Converts max results limit to long value - replacesALL_RESULTS
withLong.MAX_VALUE
}. -
hashCode
public int hashCode() -
toString
-
withReturnType
-
withStartIndex
-
withMaxResults
-
withStartIndexAndMaxResults
-
withSearchRestriction
-
baseSplitQuery
- Returns:
- query with adjusted start index and maximum results which is required for merging query results
-
splitOrRestrictionIfNeeded
Splits the query if needed. Query is split if the number of OR conditions is higher thanmaxSize
. 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
-
addToMaxResults
-
hasAllResults
public boolean hasAllResults()
-