E
- as input EntityT
- as return typepublic abstract class ODBQueryTransformer<E,T> extends Object implements UpdatableContext<com.orientechnologies.orient.core.db.OPartitionedDatabasePool>, QueryTransformer, Function<E,List<T>>, Serializable
Modifier and Type | Field and Description |
---|---|
protected com.orientechnologies.orient.core.db.OPartitionedDatabasePool |
connectionPool
Document database Connection Pool
|
protected boolean |
expectSingleResult
If true it will attempt to return only 1 Object or null if no match to query
One should use the LIMIT keyword in query when setting this to true. |
protected Map<String,?> |
fieldMapping
Map from query param name to field name or Transformer that will act on input to get param value.
|
protected com.orientechnologies.orient.core.db.ODatabase |
lastConnection |
protected boolean |
paramAsSingleInput
If true, will take whole input to transformer as a single parameter and pass it in query.
|
protected String |
query
Orientdb Query to process
|
Constructor and Description |
---|
ODBQueryTransformer() |
ODBQueryTransformer(ODBQueryTransformer t) |
ODBQueryTransformer(String query,
com.orientechnologies.orient.core.db.OPartitionedDatabasePool connectionPool) |
Modifier and Type | Method and Description |
---|---|
List<T> |
apply(E input) |
void |
close() |
protected abstract com.orientechnologies.orient.core.db.ODatabase<T> |
getConnection() |
com.orientechnologies.orient.core.db.OPartitionedDatabasePool |
getConnectionPool() |
Map<String,?> |
getFieldMapping()
Map from query param name to field name or Transformer that will act on input to get param value.
|
String |
getQuery()
Query to process.
|
boolean |
isExpectSingleResult()
If true it will attempt to return only 1 Object or null if no match to query
One should use the LIMIT keyword in query when setting this to true. |
boolean |
isParamAsSingleInput()
If true, will take whole input to transformer as a single parameter and pass it in query.
|
void |
setConnectionPool(com.orientechnologies.orient.core.db.OPartitionedDatabasePool connectionPool) |
void |
setExpectSingleResult(boolean expectSingleResult)
If true it will attempt to return only 1 Object or null if no match to query
One should use the LIMIT keyword in query when setting this to true. |
void |
setFieldMapping(Map<String,?> fieldMapping)
Map from query param name to field name or Transformer that will act on input to get param value.
|
void |
setParamAsSingleInput(boolean paramAsSingleInput)
If true, will take whole input to transformer as a single parameter and pass it in query.
|
void |
setQuery(String query)
Query to process.
|
Object |
transform(Object input)
ODBQueryTransformer
|
void |
updateContext(com.orientechnologies.orient.core.db.OPartitionedDatabasePool odbConnectionPool) |
protected transient com.orientechnologies.orient.core.db.OPartitionedDatabasePool connectionPool
ODatabasePool
,
OPartitionedDatabasePool
protected String query
protected boolean expectSingleResult
protected boolean paramAsSingleInput
protected Map<String,?> fieldMapping
protected transient com.orientechnologies.orient.core.db.ODatabase lastConnection
public ODBQueryTransformer()
public ODBQueryTransformer(String query, com.orientechnologies.orient.core.db.OPartitionedDatabasePool connectionPool)
query
- : Query to be executedconnectionPool
- : instance of Orientdb Connection pool ODatabasePool
or OPartitionedDatabasePool
public ODBQueryTransformer(ODBQueryTransformer t)
protected abstract com.orientechnologies.orient.core.db.ODatabase<T> getConnection()
public void close()
public Object transform(Object input)
Structure of Prepared Queries :
Functions to query from database :
Input Types :
Object
[] or Collection
or Map
or PageInfo
transform
in interface org.apache.commons.collections.Transformer
input
- : parameter of type `Object[]` or `Collection` or `Map` or `PageInfo
`public void updateContext(com.orientechnologies.orient.core.db.OPartitionedDatabasePool odbConnectionPool)
updateContext
in interface UpdatableContext<com.orientechnologies.orient.core.db.OPartitionedDatabasePool>
public String getQuery()
QueryTransformer
getQuery
in interface QueryTransformer
public void setQuery(String query)
QueryTransformer
setQuery
in interface QueryTransformer
public boolean isExpectSingleResult()
isExpectSingleResult
in interface QueryTransformer
public void setExpectSingleResult(boolean expectSingleResult)
setExpectSingleResult
in interface QueryTransformer
public boolean isParamAsSingleInput()
QueryTransformer
isParamAsSingleInput
in interface QueryTransformer
public void setParamAsSingleInput(boolean paramAsSingleInput)
QueryTransformer
setParamAsSingleInput
in interface QueryTransformer
public Map<String,?> getFieldMapping()
QueryTransformer
getFieldMapping
in interface QueryTransformer
public void setFieldMapping(Map<String,?> fieldMapping)
QueryTransformer
setFieldMapping
in interface QueryTransformer
public com.orientechnologies.orient.core.db.OPartitionedDatabasePool getConnectionPool()
public void setConnectionPool(com.orientechnologies.orient.core.db.OPartitionedDatabasePool connectionPool)
Copyright © 2018. All rights reserved.