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 intFlag to indicate that an EntityQuery should retrieve all results.static final intThis 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 intaddToMaxResults(int maxResults, int add) Simple utility method that increases or decreases the result limit and deals withALL_RESULTS, overflow and prevents negative values.static longallResultsToLongMax(int maxResults) Converts max results limit to long value - replacesALL_RESULTSwithLong.MAX_VALUE}.booleanintintbooleaninthashCode()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
- Specified by:
getSearchRestrictionin interfaceQuery<T>
-
getStartIndex
public int getStartIndex()- Specified by:
getStartIndexin interfaceQuery<T>
-
getMaxResults
public int getMaxResults()- Specified by:
getMaxResultsin interfaceQuery<T>
-
getReturnType
- Specified by:
getReturnTypein interfaceQuery<T>
-
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_RESULTSwithLong.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#emptyotherwise
-
withAllResults
-
addToMaxResults
-
hasAllResults
public boolean hasAllResults()
-