public class ContextImpl extends Context
An implementation for the Context
This API is experimental and subject to changeModifier and Type | Field and Description |
---|---|
protected DataConfig.Entity |
entity |
DELTA_DUMP, FIND_DELTA, FULL_DUMP, SCOPE_DOC, SCOPE_ENTITY, SCOPE_GLOBAL, SCOPE_SOLR_CORE
Constructor and Description |
---|
ContextImpl(DataConfig.Entity entity,
VariableResolverImpl resolver,
DataSource ds,
String currProcess,
Map<String,Object> global,
ContextImpl parentContext,
DocBuilder docBuilder) |
Modifier and Type | Method and Description |
---|---|
String |
currentProcess()
Returns the current process FULL_DUMP, DELTA_DUMP, FIND_DELTA
|
void |
deleteDoc(String id)
delete a document by id
|
void |
deleteDocByQuery(String query)
delete documents by query
|
List<Map<String,String>> |
getAllEntityFields()
Returns all the fields put into an entity. each item (which is a map ) in
the list corresponds to one field. each if the map contains the attribute
names and values in a field
|
DataSource |
getDataSource()
Gets the datasource instance defined for this entity.
|
DataSource |
getDataSource(String name)
Gets a new DataSource instance with a name.
|
String |
getEntityAttribute(String name)
Get the value of any attribute put into this entity
|
EntityProcessor |
getEntityProcessor()
Returns the instance of EntityProcessor used for this entity
|
Context |
getParentContext()
Get the context instance for the parent entity. works only in the full dump
If the current entity is rootmost a null is returned
|
Map<String,Object> |
getRequestParameters()
The request parameters passed over HTTP for this command the values in the
map are either String(for single valued parameters) or List
|
String |
getResolvedEntityAttribute(String name)
Get the value of any attribute put into this entity after resolving all variables found in the attribute value
|
String |
getScript()
Returns the text specified in the script tag in the data-config.xml
|
String |
getScriptLanguage()
Returns the language of the script as specified in the script tag in data-config.xml
|
Object |
getSessionAttribute(String name,
String scope)
get a value by name in the given scope (entity, document,global)
|
SolrCore |
getSolrCore()
Exposing the actual SolrCore to the components
|
Map<String,Object> |
getStats()
Makes available some basic running statistics such as "docCount",
"deletedDocCount", "rowCount", "queryCount" and "skipDocCount"
|
VariableResolver |
getVariableResolver()
Returns the VariableResolver used in this entity which can be used to
resolve the tokens in ${
|
boolean |
isRootEntity()
Returns if the current entity is the root entity
|
String |
replaceTokens(String template)
Resolve variables in a template
|
Object |
resolve(String var)
Use this directly to resolve variable
|
void |
setDoc(org.apache.solr.handler.dataimport.DocBuilder.DocWrapper docWrapper) |
void |
setSessionAttribute(String name,
Object val,
String scope)
Store values in a certain name and scope (entity, document,global)
|
protected DataConfig.Entity entity
public ContextImpl(DataConfig.Entity entity, VariableResolverImpl resolver, DataSource ds, String currProcess, Map<String,Object> global, ContextImpl parentContext, DocBuilder docBuilder)
public String getEntityAttribute(String name)
Context
getEntityAttribute
in class Context
name
- name of the attribute eg: 'name'public String getResolvedEntityAttribute(String name)
Context
getResolvedEntityAttribute
in class Context
name
- name of the attributepublic List<Map<String,String>> getAllEntityFields()
Context
getAllEntityFields
in class Context
public VariableResolver getVariableResolver()
Context
getVariableResolver
in class Context
VariableResolver
public DataSource getDataSource()
Context
getDataSource
in class Context
DataSource
,
Context.getDataSource(String)
public DataSource getDataSource(String name)
Context
getDataSource
in class Context
name
- Name of the dataSource as defined in the dataSource tagDataSource
public boolean isRootEntity()
Context
isRootEntity
in class Context
public String currentProcess()
Context
currentProcess
in class Context
public Map<String,Object> getRequestParameters()
Context
getRequestParameters
in class Context
public EntityProcessor getEntityProcessor()
Context
getEntityProcessor
in class Context
EntityProcessor
public void setSessionAttribute(String name, Object val, String scope)
Context
setSessionAttribute
in class Context
name
- the keyval
- the valuescope
- the scope in which the given key, value pair is to be storedpublic Object getSessionAttribute(String name, String scope)
Context
getSessionAttribute
in class Context
name
- the keyscope
- the scope from which the value is to be retreivedpublic Context getParentContext()
Context
getParentContext
in class Context
public void setDoc(org.apache.solr.handler.dataimport.DocBuilder.DocWrapper docWrapper)
public SolrCore getSolrCore()
Context
getSolrCore
in class Context
public Map<String,Object> getStats()
Context
public String getScript()
Context
public String getScriptLanguage()
Context
getScriptLanguage
in class Context
public void deleteDoc(String id)
Context
public void deleteDocByQuery(String query)
Context
deleteDocByQuery
in class Context
public Object resolve(String var)
Context
public String replaceTokens(String template)
Context
replaceTokens
in class Context