Class Neo4jItemReader<T>
- All Implemented Interfaces:
ItemReader<T>
,ItemStream
,ItemStreamReader<T>
,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 the
AbstractItemCountingItemStreamItemReader.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 set
saveState=false
if used in a multi-threaded environment (no restart
available).
- Author:
- Michael Minella, Mahmoud Ben Hassine
-
Field Summary
Fields inherited from class org.springframework.batch.item.data.AbstractPaginatedDataItemReader
page, pageSize, results
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Deprecated.Checks mandatory propertiesDeprecated.Method thisItemStreamReader
delegates to for the actual work of reading a page.protected String
Deprecated.Deprecated.protected org.neo4j.ogm.session.SessionFactory
Deprecated.Deprecated.void
setMatchStatement
(String matchStatement) Deprecated.An optional match fragment of the cypher query.void
setOrderByStatement
(String orderByStatement) Deprecated.A list of properties to order the results by.void
setParameterValues
(Map<String, Object> parameterValues) Deprecated.Optional parameters to be used in the cypher query.void
setReturnStatement
(String returnStatement) Deprecated.The return statement of the cypher query.void
setSessionFactory
(org.neo4j.ogm.session.SessionFactory sessionFactory) Deprecated.Establish the session factory for the reader.void
setStartStatement
(String startStatement) Deprecated.The start segment of the cypher query.void
setTargetType
(Class<T> targetType) Deprecated.The object type to be returned from each call toAbstractItemCountingItemStreamItemReader.read()
void
setWhereStatement
(String whereStatement) Deprecated.An optional where fragment of the cypher query.Methods inherited from class org.springframework.batch.item.data.AbstractPaginatedDataItemReader
doClose, doOpen, doRead, jumpToItem, setPageSize
Methods inherited from class org.springframework.batch.item.support.AbstractItemCountingItemStreamItemReader
close, getCurrentItemCount, isSaveState, open, read, setCurrentItemCount, setMaxItemCount, setSaveState, update
Methods inherited from class org.springframework.batch.item.ItemStreamSupport
getExecutionContextKey, getName, setExecutionContextName, setName
-
Field Details
-
logger
protected org.apache.commons.logging.Log loggerDeprecated.
-
-
Constructor Details
-
Neo4jItemReader
public Neo4jItemReader()Deprecated.
-
-
Method Details
-
setParameterValues
Deprecated.Optional parameters to be used in the cypher query.- Parameters:
parameterValues
- the parameter values to be used in the cypher query
-
getParameterValues
Deprecated. -
setStartStatement
Deprecated.The start segment of the cypher query. START is prepended to the statement provided and should not be included.- Parameters:
startStatement
- the start fragment of the cypher query.
-
setReturnStatement
Deprecated.The return statement of the cypher query. RETURN is prepended to the statement provided and should not be included- Parameters:
returnStatement
- the return fragment of the cypher query.
-
setMatchStatement
Deprecated.An optional match fragment of the cypher query. MATCH is prepended to the statement provided and should not be included.- Parameters:
matchStatement
- the match fragment of the cypher query
-
setWhereStatement
Deprecated.An optional where fragment of the cypher query. WHERE is prepended to the statement provided and should not be included.- Parameters:
whereStatement
- where fragment of the cypher query
-
setOrderByStatement
Deprecated.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.- Parameters:
orderByStatement
- order by fragment of the cypher query.
-
getSessionFactory
protected org.neo4j.ogm.session.SessionFactory getSessionFactory()Deprecated. -
setSessionFactory
public void setSessionFactory(org.neo4j.ogm.session.SessionFactory sessionFactory) Deprecated.Establish the session factory for the reader.- Parameters:
sessionFactory
- the factory to use for the reader.
-
setTargetType
Deprecated.The object type to be returned from each call toAbstractItemCountingItemStreamItemReader.read()
- Parameters:
targetType
- the type of object to return.
-
getTargetType
Deprecated. -
generateLimitCypherQuery
Deprecated. -
afterPropertiesSet
Deprecated.Checks mandatory properties- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Throws:
Exception
- See Also:
-
InitializingBean.afterPropertiesSet()
-
doPageRead
Deprecated.Description copied from class:AbstractPaginatedDataItemReader
Method thisItemStreamReader
delegates to for the actual work of reading a page. Each time this method is called, the resultingIterator
should contain the items read within the next page.
If theIterator
is empty or null when it is returned, thisItemReader
will assume that the input has been exhausted.- Specified by:
doPageRead
in classAbstractPaginatedDataItemReader<T>
- Returns:
- an
Iterator
containing the items within a page.
-