Package pro.taskana.common.api
Interface BaseQuery<T,U extends Enum<U> & QueryColumnName>
- Type Parameters:
T- specifies the return type of the follwing methodsU- specifies the type of the enum used
public interface BaseQuery<T,U extends Enum<U> & QueryColumnName>
Main query interface.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumDetermines the sort direction. -
Method Summary
Modifier and TypeMethodDescriptionlongcount()Counting the amount of rows/results for the current query.list()This method will return a list of definedBaseQueryobjects.list(int offset, int limit) This method will return a list of definedBaseQueryobjects with specified offset and an limit.listPage(int pageNumber, int pageSize) This method will return all results for page X with a size of Y of the current query.
Negative pageNumber/size will be changed to 1 or 0 and the last page might contains less elements.listValues(U dbColumnName, BaseQuery.SortDirection sortDirection) This method will return all currently existing values of a DB-Table once.single()This method will return a single object ofBaseQuery.static String[]toLowerCopy(String... source)
-
Method Details
-
list
This method will return a list of definedBaseQueryobjects. In case of a TaskQuery, this method can throw a NotAuthorizedToQueryWorkbasketException.- Returns:
- List containing elements of type T
-
list
This method will return a list of definedBaseQueryobjects with specified offset and an limit. In case of a TaskQuery, this method can throw a NotAuthorizedToQueryWorkbasketException.- Parameters:
offset- index of the first element which should be returned.limit- number of elements which should be returned beginning with offset.- Returns:
- List containing elements of type T
-
listValues
This method will return all currently existing values of a DB-Table once. The order of the returning values can be configured ASC oder DEC - DEFAULT at NULL is ASC.
All called orderBy()-Methods will be override. Just the current column-values will be ordered itself by the given direction.- Parameters:
dbColumnName- column name of a existing DB Table.sortDirection- Determines whether the result is sorted in ascending or descending order. If sortDirection is null, the result is sorted in ascending order- Returns:
- a list of all existing values.
-
listPage
This method will return all results for page X with a size of Y of the current query.
Negative pageNumber/size will be changed to 1 or 0 and the last page might contains less elements. In case of a TaskQuery, this method can throw a NotAuthorizedToQueryWorkbasketException.- Parameters:
pageNumber- current pagination page starting at 1.pageSize- amount of elements for this page.- Returns:
- resulList for the current query starting at X and returning max Y elements.
-
single
T single()This method will return a single object ofBaseQuery. This method can throw a TooManyResultsException. In case of a TaskQuery, this method can throw a NotAuthorizedToQueryWorkbasketException.- Returns:
- T a single object of given Type.
-
count
long count()Counting the amount of rows/results for the current query. This can be used for a pagination afterwards. In case of a TaskQuery, this method can throw a NotAuthorizedToQueryWorkbasketException.- Returns:
- resultRowCount
-
toLowerCopy
-