|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.batch.item.database.support.AbstractSqlPagingQueryProvider
public abstract class AbstractSqlPagingQueryProvider
Abstract SQL Paging Query Provider to serve as a base class for all provided SQL paging query providers. Any implementation must provide a way to specify the select clause, from clause and optionally a where clause. In addition a way to specify a single column sort key must also be provided. This sort key will be used to provide the paging functionality. It is recommended that there should be an index for the sort key to provide better performance. Provides properties and preparation for the mandatory "selectClause" and "fromClause" as well as for the optional "whereClause". Also provides property for the mandatory "sortKey".
Constructor Summary | |
---|---|
AbstractSqlPagingQueryProvider()
|
Method Summary | |
---|---|
abstract String |
generateFirstPageQuery(int pageSize)
Method generating the query string to be used for retrieving the first page. |
abstract String |
generateJumpToItemQuery(int itemIndex,
int pageSize)
Method generating the query string to be used for jumping to a specific item position. |
abstract String |
generateRemainingPagesQuery(int pageSize)
Method generating the query string to be used for retrieving the pages following the first page. |
protected String |
getFromClause()
|
int |
getParameterCount()
The number of parameters that are declared in the query |
protected String |
getSelectClause()
|
String |
getSortKey()
The sort key (unique single column name). |
protected String |
getSortKeyPlaceHolder()
The sort key placeholder will vary depending on whether named parameters or traditional placeholders are used in query strings. |
String |
getSortKeyWithoutAlias()
The sort key (unique single column name) without alias. |
protected String |
getWhereClause()
|
void |
init(DataSource dataSource)
Check mandatory properties. |
boolean |
isAscending()
Get the flag that signals that the sort key is applied ascending. |
boolean |
isUsingNamedParameters()
Indicate whether the generated queries use named parameter syntax. |
void |
setAscending(boolean ascending)
Set the flag that signals that the sort key is applied ascending (default true). |
void |
setFromClause(String fromClause)
|
void |
setSelectClause(String selectClause)
|
void |
setSortKey(String sortKey)
|
void |
setWhereClause(String whereClause)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public AbstractSqlPagingQueryProvider()
Method Detail |
---|
public void setSelectClause(String selectClause)
selectClause
- SELECT clause part of SQL query stringprotected String getSelectClause()
public void setFromClause(String fromClause)
fromClause
- FROM clause part of SQL query stringprotected String getFromClause()
public void setWhereClause(String whereClause)
whereClause
- WHERE clause part of SQL query stringprotected String getWhereClause()
public void setSortKey(String sortKey)
sortKey
- key to use to sort and limit page contentpublic void setAscending(boolean ascending)
ascending
- the ascending value to setpublic boolean isAscending()
public String getSortKey()
PagingQueryProvider
getSortKey
in interface PagingQueryProvider
public String getSortKeyWithoutAlias()
PagingQueryProvider
getSortKeyWithoutAlias
in interface PagingQueryProvider
public int getParameterCount()
PagingQueryProvider
getParameterCount
in interface PagingQueryProvider
public boolean isUsingNamedParameters()
PagingQueryProvider
isUsingNamedParameters
in interface PagingQueryProvider
protected String getSortKeyPlaceHolder()
public void init(DataSource dataSource) throws Exception
init
in interface PagingQueryProvider
dataSource
- DataSource to use for any initialization
Exception
InitializingBean.afterPropertiesSet()
public abstract String generateFirstPageQuery(int pageSize)
generateFirstPageQuery
in interface PagingQueryProvider
pageSize
- number of rows to read per page
public abstract String generateRemainingPagesQuery(int pageSize)
generateRemainingPagesQuery
in interface PagingQueryProvider
pageSize
- number of rows to read per page
public abstract String generateJumpToItemQuery(int itemIndex, int pageSize)
generateJumpToItemQuery
in interface PagingQueryProvider
itemIndex
- the index of the item to jump topageSize
- number of rows to read per page
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |