org.sqlproc.engine.impl
Class SqlProcessContext

java.lang.Object
  extended by org.sqlproc.engine.impl.SqlProcessContext
All Implemented Interfaces:
SqlRuntimeContext

public class SqlProcessContext
extends Object
implements SqlRuntimeContext

The crate (design pattern) for all input parameters for the SqlMetaStatement.process(org.sqlproc.engine.impl.SqlMetaStatement.Type, Object, SqlControl, SqlEngine) 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
(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)  Set<String> oppositeNames
          Unset features in the runtime.
(package private)  SqlControl sqlControl
          The compound parameters controlling the META SQL execution.
(package private)  SqlEngine sqlEngine
          The primary SQL Processor class for the META SQL execution.
(package private)  SqlMetaStatement.Type sqlStatementType
          The SQL command type.
 
Constructor Summary
SqlProcessContext(SqlMetaStatement.Type sqlStatementType, Object dynamicInputValues, SqlControl sqlControl, SqlEngine sqlEngine)
          Creates a new instance.
SqlProcessContext(SqlProcessContext ctx, Object dynamicInputValues, SqlControl sqlControl)
          Creates a new instance.
 
Method Summary
 Object getDynamicInputValues()
          Returns the SQL statement dynamic parameters.
 String getFeature(String name)
          Convenient method to obtain a String feature based on the name.
 Integer getFeatureAsInt(String name)
          Convenient method to obtain an Integer feature based on the name.
 Object getFeatureAsObject(String name)
          Convenient method to obtain an Object feature based on the name.
 String[] getFeatures(String name)
          Convenient method to obtain a String array features based on the name.
(package private)  List<SqlOrder> getOrder()
          Returns the list of ordering directives.
(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.
 SqlPluginFactory getPluginFactory()
          Returns the factory responsible for the SQL Processor plugins.
 Object getRawFeature(String name)
          Convenient method to obtain a feature based on the name.
(package private)  SqlMetaStatement.Type getSqlStatementType()
          Returns the SQL command type.
 Object getStaticInputValues()
          Returns the SQL statement static parameters.
 SqlTypeFactory getTypeFactory()
          Returns the factory responsible for the META types construction.
private  void initFeatures()
          Initialize the optional features.
 boolean isFeature(String name)
          Convenient method to obtain a boolean feature based on the name.
 String toString()
          For debug purposes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

sqlStatementType

SqlMetaStatement.Type sqlStatementType
The SQL command type.


dynamicInputValues

Object dynamicInputValues
The SQL statement dynamic parameters.


sqlControl

SqlControl sqlControl
The compound parameters controlling the META SQL execution.


sqlEngine

SqlEngine sqlEngine
The primary SQL Processor class for the META SQL execution.


inSqlSetOrInsert

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


oppositeNames

Set<String> oppositeNames
Unset features in the runtime.

Constructor Detail

SqlProcessContext

SqlProcessContext(SqlMetaStatement.Type sqlStatementType,
                  Object dynamicInputValues,
                  SqlControl sqlControl,
                  SqlEngine sqlEngine)
Creates a new instance.

Parameters:
sqlStatementType - the type of the SQL command
dynamicInputValues - the dynamic input parameters
sqlControl - the compound parameters controlling the META SQL execution
sqlEngine - the primary SQL Processor class for the META SQL execution

SqlProcessContext

SqlProcessContext(SqlProcessContext ctx,
                  Object dynamicInputValues,
                  SqlControl sqlControl)
Creates a new instance.

Parameters:
ctx - the crate for all input parameters and the context of processing
dynamicInputValues - the dynamic input parameters
sqlControl - the compound parameters controlling the META SQL execution
Method Detail

initFeatures

private void initFeatures()
Initialize the optional features.


getSqlStatementType

SqlMetaStatement.Type getSqlStatementType()
Returns the SQL command type.

Returns:
the SQL command type

getDynamicInputValues

public Object getDynamicInputValues()
Returns the SQL statement dynamic parameters.

Returns:
the SQL statement dynamic parameters

getStaticInputValues

public Object getStaticInputValues()
Returns the SQL statement static parameters.

Returns:
the SQL statement static parameters

getFeature

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

Specified by:
getFeature in interface SqlRuntimeContext
Parameters:
name - name of the feature
Returns:
value of the feature

getFeatures

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

Specified by:
getFeatures in interface SqlRuntimeContext
Parameters:
name - name of the feature
Returns:
the array of the feature values

isFeature

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

Specified by:
isFeature in interface SqlRuntimeContext
Parameters:
name - name of the feature
Returns:
value of the feature

getFeatureAsInt

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

Specified by:
getFeatureAsInt in interface SqlRuntimeContext
Parameters:
name - name of the feature
Returns:
value of the feature

getFeatureAsObject

public Object getFeatureAsObject(String name)
Convenient method to obtain an Object feature based on the name.

Specified by:
getFeatureAsObject in interface SqlRuntimeContext
Parameters:
name - name of the feature
Returns:
value of the feature

getRawFeature

public Object getRawFeature(String name)
Convenient method to obtain a feature based on the name.

Specified by:
getRawFeature in interface SqlRuntimeContext
Parameters:
name - name of the feature
Returns:
value of the feature

getOrder

List<SqlOrder> getOrder()
Returns the list of ordering directives.

Returns:
the list of ordering directives

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

getTypeFactory

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

Specified by:
getTypeFactory in interface SqlRuntimeContext
Returns:
the factory for the META types construction

getPluginFactory

public SqlPluginFactory getPluginFactory()
Returns the factory responsible for the SQL Processor plugins.

Specified by:
getPluginFactory in interface SqlRuntimeContext
Returns:
the factory for the SQL Processor plugins

toString

public String toString()
For debug purposes.

Overrides:
toString in class Object
Returns:
a String representation for a debug output


Copyright © 2014. All rights reserved.