Package org.europa.together.domain
Class JpaPagination
java.lang.Object
org.europa.together.domain.JpaPagination
Be always aware, when using listAll() because some database tables with a
giant amount of rows will slow down your application dramatically. The
JpaPagination is designed to limit your result set. It avoid a slow
performing OFFSET and implement instead the seek method.
To secure a correct result set, the results aer by default sorted by the primary key of the database table in an ascending manner. This behavior can be changed.
Its necessary to define the Primary Key from the Domain Object and not from the database table name.
To secure a correct result set, the results aer by default sorted by the primary key of the database table in an ascending manner. This behavior can be changed.
Its necessary to define the Primary Key from the Domain Object and not from the database table name.
-
Field Summary
-
Constructor Summary
ConstructorDescriptionDefault Constructor.JpaPagination
(String primaryKey) Allow to set the PrimaryKey (PK) of the database table. -
Method Summary
Modifier and TypeMethodDescriptionGet the 2 nd parameter, besides the primarey key for ordering the result set.Get all Boolean based filters >KEY, Value< to reduce the result set.Get all Date based filters >KEY, Value< to reduce the result set.Get all Float based filters >KEY, Value< to reduce the result set.Get all Integer based filters >KEY, Value< to reduce the result set.Get all String based filters >KEY, Value< to reduce the result set.Get the pivot element, where the page break occur.int
get the amount of elements will be placed on a page.Get the direction (forward or backward) of the paging.Get the defined primarey key of the Domain Object.Get if the sorting is DESC or ASC.void
setAdditionalOrdering
(String additionalOrdering) Set the 2 nd parameter, besides the primarey key for ordering the result set.void
setFilterBooleanCriteria
(Map<String, Boolean> filterBooleanCriteria) Set all Boolean based filters >KEY, Value< to reduce the result set.void
setFilterDateCriteria
(Map<String, Date> filterDateCriteria) Set all Date based filters >KEY, Value< to reduce the result set.void
setFilterFloatCriteria
(Map<String, Float> filterFloatCriteria) Set all Float based filters >KEY, Value< to reduce the result set.void
setFilterIntegerCriteria
(Map<String, Integer> filterIntegerCriteria) Set all Integer based filters >KEY, Value< to reduce the result set.void
setFilterStringCriteria
(Map<String, String> filterStringCriteria) Set all String based filters >KEY, Value< to reduce the result set.void
setPageBreak
(String pageBreak) Define the pivot element, where the page break occur.void
setPageSize
(int limit) Define the amount of elements will be placed on a page.void
Define the direction (forward or backward) of the paging.void
setPrimaryKey
(String primaryKey) Set the primarey key of the Domain Object.void
setSorting
(String ordering) Define if the sorting is DESC or ASC.toString()
-
Field Details
-
ORDER_ASC
Ascending sorting order of the whole result set.- See Also:
-
ORDER_DESC
Descending sorting order of the whole result set.- See Also:
-
PAGING_FOREWARD
Define if the pagination goes ahead.- See Also:
-
PAGING_BACKWARD
Define if the pgination goes backwards.- See Also:
-
-
Constructor Details
-
JpaPagination
public JpaPagination()Default Constructor. -
JpaPagination
Allow to set the PrimaryKey (PK) of the database table. Be aware, that the PK is not the colum name of the table. The PK is defined by Domain Object is used.- Parameters:
primaryKey
- as String
-
-
Method Details
-
toString
-
getPageSize
public int getPageSize()get the amount of elements will be placed on a page.- Returns:
- pageSize as Integer
-
setPageSize
public void setPageSize(int limit) Define the amount of elements will be placed on a page.- Parameters:
limit
- as Integer
-
getSorting
Get if the sorting is DESC or ASC.- Returns:
- sorting as String
-
setSorting
Define if the sorting is DESC or ASC.- Parameters:
ordering
- as String
-
getPaging
Get the direction (forward or backward) of the paging.- Returns:
- paging as String
-
setPaging
Define the direction (forward or backward) of the paging.- Parameters:
direction
- as String
-
getPrimaryKey
Get the defined primarey key of the Domain Object.- Returns:
- primaryKey as String
-
setPrimaryKey
Set the primarey key of the Domain Object.- Parameters:
primaryKey
- as String
-
getPageBreak
Get the pivot element, where the page break occur.- Returns:
- peageBreak as String
-
setPageBreak
Define the pivot element, where the page break occur.- Parameters:
pageBreak
- as String
-
getAdditionalOrdering
Get the 2 nd parameter, besides the primarey key for ordering the result set.- Returns:
- additionalOrdering as String
-
setAdditionalOrdering
Set the 2 nd parameter, besides the primarey key for ordering the result set.- Parameters:
additionalOrdering
- as String
-
getFilterStringCriteria
Get all String based filters >KEY, Value< to reduce the result set.- Returns:
- filterStringCriteria as Map
-
setFilterStringCriteria
Set all String based filters >KEY, Value< to reduce the result set.- Parameters:
filterStringCriteria
- as Map
-
getFilterBooleanCriteria
Get all Boolean based filters >KEY, Value< to reduce the result set.- Returns:
- filterBooleanCriteria as Map
-
setFilterBooleanCriteria
Set all Boolean based filters >KEY, Value< to reduce the result set.- Parameters:
filterBooleanCriteria
- as Map
-
getFilterIntegerCriteria
Get all Integer based filters >KEY, Value< to reduce the result set.- Returns:
- filterIntegerCriteria as Map
-
setFilterIntegerCriteria
Set all Integer based filters >KEY, Value< to reduce the result set.- Parameters:
filterIntegerCriteria
- as Map
-
getFilterFloatCriteria
Get all Float based filters >KEY, Value< to reduce the result set.- Returns:
- filterFloatCriteria as Map
-
setFilterFloatCriteria
Set all Float based filters >KEY, Value< to reduce the result set.- Parameters:
filterFloatCriteria
- as Map
-
getFilterDateCriteria
Get all Date based filters >KEY, Value< to reduce the result set.- Returns:
- filterDateCriteria as Map
-
setFilterDateCriteria
Set all Date based filters >KEY, Value< to reduce the result set.- Parameters:
filterDateCriteria
- as Map
-