类 AbstractNeo4jItemReader<T>
- java.lang.Object
- org.springframework.batch.item.ItemStreamSupport
- org.springframework.batch.item.support.AbstractItemStreamItemReader<T>
- org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader<T>
- org.springframework.batch.item.data.AbstractPaginatedDataItemReader<T>
- org.springframework.batch.item.data.AbstractNeo4jItemReader<T>
- 所有已实现的接口:
ItemReader<T>
,ItemStream
,ItemStreamReader<T>
,org.springframework.beans.factory.InitializingBean
- 直接已知子类:
Neo4jItemReader
public abstract class AbstractNeo4jItemReader<T> extends AbstractPaginatedDataItemReader<T> implements org.springframework.beans.factory.InitializingBean
Restartable
ItemReader
that reads objects from the graph database Neo4j via a paging technique.It executes cypher queries built from the statement fragments provided to retrieve the requested data. The query is executed using paged requests of a size specified in
AbstractPaginatedDataItemReader.setPageSize(int)
. Additional pages are requested as needed when theAbstractItemCountingItemStreamItemReader.read()
method is called. On restart, the reader will begin again at the same number item it left off at.Performance is dependent on your Neo4J configuration (embedded or remote) as well as page size. Setting a fairly large page size and using a commit interval that matches the page size should provide better performance.
This implementation is thread-safe between calls to
AbstractItemCountingItemStreamItemReader.open(org.springframework.batch.item.ExecutionContext)
, however you should setsaveState=false
if used in a multi-threaded environment (no restart available).- 从以下版本开始:
- 3.07
- 作者:
- Michael Minella
字段概要
字段 修饰符和类型 字段 说明 protected org.apache.commons.logging.Log
logger
从类继承的字段 org.springframework.batch.item.data.AbstractPaginatedDataItemReader
page, pageSize, results
构造器概要
构造器 构造器 说明 AbstractNeo4jItemReader()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 void
afterPropertiesSet()
Checks mandatory propertiesprotected java.lang.String
generateLimitCypherQuery()
protected java.util.Map<java.lang.String,java.lang.Object>
getParameterValues()
protected org.neo4j.ogm.session.SessionFactory
getSessionFactory()
protected java.lang.Class<T>
getTargetType()
void
setMatchStatement(java.lang.String matchStatement)
An optional match fragment of the cypher query.void
setOrderByStatement(java.lang.String orderByStatement)
A list of properties to order the results by.void
setParameterValues(java.util.Map<java.lang.String,java.lang.Object> parameterValues)
Optional parameters to be used in the cypher query.void
setReturnStatement(java.lang.String returnStatement)
The return statement of the cypher query.void
setSessionFactory(org.neo4j.ogm.session.SessionFactory sessionFactory)
Establish the session factory for the reader.void
setStartStatement(java.lang.String startStatement)
The start segment of the cypher query.void
setTargetType(java.lang.Class<T> targetType)
The object type to be returned from each call toAbstractItemCountingItemStreamItemReader.read()
void
setWhereStatement(java.lang.String whereStatement)
An optional where fragment of the cypher query.从类继承的方法 org.springframework.batch.item.data.AbstractPaginatedDataItemReader
doClose, doOpen, doPageRead, doRead, jumpToItem, setPageSize
从类继承的方法 org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader
close, getCurrentItemCount, isSaveState, open, read, setCurrentItemCount, setMaxItemCount, setSaveState, update
从类继承的方法 org.springframework.batch.item.ItemStreamSupport
getExecutionContextKey, setExecutionContextName, setName
字段详细资料
logger
protected org.apache.commons.logging.Log logger
构造器详细资料
AbstractNeo4jItemReader
public AbstractNeo4jItemReader()
方法详细资料
setParameterValues
public void setParameterValues(java.util.Map<java.lang.String,java.lang.Object> parameterValues)
Optional parameters to be used in the cypher query.- 参数:
parameterValues
- the parameter values to be used in the cypher query
getParameterValues
protected final java.util.Map<java.lang.String,java.lang.Object> getParameterValues()
setStartStatement
public void setStartStatement(java.lang.String startStatement)
The start segment of the cypher query. START is prepended to the statement provided and should not be included.- 参数:
startStatement
- the start fragment of the cypher query.
setReturnStatement
public void setReturnStatement(java.lang.String returnStatement)
The return statement of the cypher query. RETURN is prepended to the statement provided and should not be included- 参数:
returnStatement
- the return fragment of the cypher query.
setMatchStatement
public void setMatchStatement(java.lang.String matchStatement)
An optional match fragment of the cypher query. MATCH is prepended to the statement provided and should not be included.- 参数:
matchStatement
- the match fragment of the cypher query
setWhereStatement
public void setWhereStatement(java.lang.String whereStatement)
An optional where fragment of the cypher query. WHERE is prepended to the statement provided and should not be included.- 参数:
whereStatement
- where fragment of the cypher query
setOrderByStatement
public void setOrderByStatement(java.lang.String orderByStatement)
A list of properties to order the results by. This is required so that subsequent page requests pull back the segment of results correctly. ORDER BY is prepended to the statement provided and should not be included.- 参数:
orderByStatement
- order by fragment of the cypher query.
getSessionFactory
protected org.neo4j.ogm.session.SessionFactory getSessionFactory()
setSessionFactory
public void setSessionFactory(org.neo4j.ogm.session.SessionFactory sessionFactory)
Establish the session factory for the reader.- 参数:
sessionFactory
- the factory to use for the reader.
setTargetType
public void setTargetType(java.lang.Class<T> targetType)
The object type to be returned from each call toAbstractItemCountingItemStreamItemReader.read()
- 参数:
targetType
- the type of object to return.
getTargetType
protected final java.lang.Class<T> getTargetType()
generateLimitCypherQuery
protected java.lang.String generateLimitCypherQuery()
afterPropertiesSet
public void afterPropertiesSet() throws java.lang.Exception
Checks mandatory properties- 指定者:
afterPropertiesSet
在接口中org.springframework.beans.factory.InitializingBean
- 抛出:
java.lang.Exception
- 另请参阅:
InitializingBean.afterPropertiesSet()