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 Classes Modifier and Type Interface Description static classBaseQuery.SortDirectionDetermines the sort direction.
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description longcount()Counting the amount of rows/results for the current query.List<T>list()This method will return a list of definedBaseQueryobjects.List<T>list(int offset, int limit)This method will return a list of definedBaseQueryobjects with specified offset and an limit.default List<T>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.List<String>listValues(U dbColumnName, BaseQuery.SortDirection sortDirection)This method will return all currently existing values of a DB-Table once.Tsingle()This method will return a single object ofBaseQuery.default String[]toUpperCopy(String... source)
-
-
-
Method Detail
-
list
List<T> 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
List<T> list(int offset, int limit)
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
List<String> listValues(U dbColumnName, BaseQuery.SortDirection sortDirection)
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
default List<T> 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. 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. 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
-
-