org.sqlproc.engine.impl
Class SqlProcessContext

java.lang.Object
  extended by org.sqlproc.engine.impl.SqlProcessContext

public class SqlProcessContext
extends Object

The crate (design pattern) for all input parameters for the SqlMetaStatement.process(org.sqlproc.engine.impl.SqlMetaStatement.Type, Object, Object, List, Map, SqlTypeFactory) . Also can work as a context for a dynamic ANSI SQL query generation. This processing is based on the contract SqlMetaElement.process(SqlProcessContext).

Author:
Vladimir Hudec

Field Summary
private static ThreadLocal<Map<String,Object>> currentFeatures
          The thread local holder for the configuration object.
private static ThreadLocal<SqlTypeFactory> currentTypeFactory
          The thread local holder for the factory responsible for the META types construction.
(package private)  Object dynamicInputValues
          The SQL statement dynamic parameters.
(package private)  boolean inSqlSetOrInsert
          An indicator, that the processing is inside of the special SQL fragment - SET or VALUES.
(package private)  List<SqlOrder> order
          The list of ordering directives.
(package private)  SqlMetaStatement.Type sqlStatementType
          The SQL command type.
(package private)  Object staticInputValues
          The SQL statement static parameters.
 
Constructor Summary
SqlProcessContext(SqlMetaStatement.Type sqlStatementType, Object dynamicInputValues, Object staticInputValues, List<SqlOrder> order, Map<String,Object> features, SqlTypeFactory typeFactory)
          Creates a new instance.
 
Method Summary
static String getFeature(String name)
          Convenient method to obtain a String feature based on the name.
static Integer getFeatureAsInt(String name)
          Convenient method to obtain an Integer feature based on the name.
(package private) static Map<String,Object> getFeatures()
          Returns the features for the current thread.
static String[] getFeatures(String name)
          Convenient method to obtain a String array features based on the name.
(package private)  SqlOrder.Order getOrder(int orderIndex)
          Convenient method to obtain the ordering directive based on the index.
(package private)  int getOrderIndex(int orderId)
          Convenient method to obtain the index of the ordering directive.
 SqlMetaStatement.Type getSqlStatementType()
           
static SqlTypeFactory getTypeFactory()
          Returns the factory for the current thread responsible for the META types construction.
static boolean isFeature(String name)
          Convenient method to obtain a boolean feature based on the name.
(package private) static void set(Map<String,Object> features)
          THIS METHOD IS NOT PART OF THE SQL PROCESSOR PUBLIC API.
(package private) static void setTypeFactory(SqlTypeFactory typeFactory)
          THIS METHOD IS NOT PART OF THE SQL PROCESSOR PUBLIC API.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

sqlStatementType

SqlMetaStatement.Type sqlStatementType
The SQL command type.


dynamicInputValues

Object dynamicInputValues
The SQL statement dynamic parameters.


staticInputValues

Object staticInputValues
The SQL statement static parameters.


order

List<SqlOrder> order
The list of ordering directives.


inSqlSetOrInsert

boolean inSqlSetOrInsert
An indicator, that the processing is inside of the special SQL fragment - SET or VALUES.


currentFeatures

private static final ThreadLocal<Map<String,Object>> currentFeatures
The thread local holder for the configuration object.


currentTypeFactory

private static final ThreadLocal<SqlTypeFactory> currentTypeFactory
The thread local holder for the factory responsible for the META types construction.

Constructor Detail

SqlProcessContext

SqlProcessContext(SqlMetaStatement.Type sqlStatementType,
                  Object dynamicInputValues,
                  Object staticInputValues,
                  List<SqlOrder> order,
                  Map<String,Object> features,
                  SqlTypeFactory typeFactory)
Creates a new instance.

Parameters:
sqlStatementType - the type of the SQL command
dynamicInputValues - the dynamic input parameters
staticInputValues - the static input parameters
order - the list of ordering directives
features - the optional features
typeFactory - the factory for the META types construction
Method Detail

getSqlStatementType

public SqlMetaStatement.Type getSqlStatementType()

getFeature

public static String getFeature(String name)
Convenient method to obtain a String feature based on the name.

Parameters:
name - name of the feature
Returns:
value of the feature

getFeatures

public static String[] getFeatures(String name)
Convenient method to obtain a String array features based on the name.

Parameters:
name - name of the feature
Returns:
the array of the feature values

isFeature

public static boolean isFeature(String name)
Convenient method to obtain a boolean feature based on the name.

Parameters:
name - name of the feature
Returns:
value of the feature

getFeatureAsInt

public static Integer getFeatureAsInt(String name)
Convenient method to obtain an Integer feature based on the name.

Parameters:
name - name of the feature
Returns:
value of the feature

getOrderIndex

int getOrderIndex(int orderId)
Convenient method to obtain the index of the ordering directive.

Parameters:
orderId - the order number
Returns:
the index of the ordering directive

getOrder

SqlOrder.Order getOrder(int orderIndex)
Convenient method to obtain the ordering directive based on the index.

Parameters:
orderIndex - the index of the ordering rule
Returns:
the ordering directive

getFeatures

static Map<String,Object> getFeatures()
Returns the features for the current thread.

Returns:
the current thread's features

set

static void set(Map<String,Object> features)
THIS METHOD IS NOT PART OF THE SQL PROCESSOR PUBLIC API. DO NOT USE IT.

Parameters:
features - the current features or null for this thread

getTypeFactory

public static SqlTypeFactory getTypeFactory()
Returns the factory for the current thread responsible for the META types construction.

Returns:
the current thread's factory for the META types construction

setTypeFactory

static void setTypeFactory(SqlTypeFactory typeFactory)
THIS METHOD IS NOT PART OF THE SQL PROCESSOR PUBLIC API. DO NOT USE IT.

Parameters:
typeFactory - the factory for the META types construction


Copyright © 2011. All Rights Reserved.