org.sqlproc.engine.plugin
Class DefaultSqlPlugins

java.lang.Object
  extended by org.sqlproc.engine.plugin.DefaultSqlPlugins
All Implemented Interfaces:
IsEmptyPlugin, IsTruePlugin, SqlCountPlugin, SqlFromToPlugin, SqlIdentityPlugin, SqlSequencePlugin

public class DefaultSqlPlugins
extends Object
implements IsEmptyPlugin, IsTruePlugin, SqlCountPlugin, SqlFromToPlugin, SqlSequencePlugin, SqlIdentityPlugin

The SQL Processor plugins standard implementation.

Author:
Vladimir Hudec

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.sqlproc.engine.plugin.SqlFromToPlugin
SqlFromToPlugin.LimitType
 
Field Summary
static String MODIFIER_ANY
          The modifier used to detect the empty value and true value.
static String MODIFIER_CALL
          The modifier used to detect the method call invoked on the parent object.
static String MODIFIER_NOTNULL
          The modifier used to detect the empty value and true value.
static String MODIFIER_NULL
          The modifier used to detect the empty value and true value.
 
Fields inherited from interface org.sqlproc.engine.plugin.SqlSequencePlugin
SUPPVAL_SEQUENCE
 
Fields inherited from interface org.sqlproc.engine.plugin.SqlIdentityPlugin
SUPPVAL_IDENTITY_SELECT
 
Constructor Summary
DefaultSqlPlugins()
           
 
Method Summary
private  Boolean callMethod(String attributeName, Object parentObj, Map<String,String> values)
           
 String identitySelect(String identitySelectName, String tableName, String columnName)
          Used to construct the identity SELECT SQL.
 boolean isNotEmpty(String attributeName, Object obj, Object parentObj, SqlMetaType sqlMetaType, String inOutModifier, boolean inSqlSetOrInsert, Map<String,String> values, Map<String,Object> features)
          Used for the evaluation of the emptiness in the META SQL fragments.
 boolean isTrue(String attributeName, Object obj, Object parentObj, SqlMetaType sqlMetaType, String inOutModifier, Map<String,String> values, Map<String,Object> features)
          Used for the evaluation of the logical expression in the conditional META SQL fragments.
private  SqlFromToPlugin.LimitType limitQuery(String limitPattern, SqlFromToPlugin.LimitType limitType, String queryString, StringBuilder queryResult, Integer firstResult, Integer maxResults)
           
 SqlFromToPlugin.LimitType limitQuery(String queryString, StringBuilder queryResult, Integer firstResult, Integer maxResults, boolean ordered)
          Used to construct the FROM-TO SQL.
 String sequenceSelect(String sequenceName)
          Used to construct the sequence SELECT SQL.
 String sqlCount(StringBuilder sql)
          Used to construct the COUNT SQL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MODIFIER_NOTNULL

public static final String MODIFIER_NOTNULL
The modifier used to detect the empty value and true value. For the usage please see the Wiki Tutorials.

See Also:
Constant Field Values

MODIFIER_ANY

public static final String MODIFIER_ANY
The modifier used to detect the empty value and true value. For the usage please see the Wiki Tutorials.

See Also:
Constant Field Values

MODIFIER_NULL

public static final String MODIFIER_NULL
The modifier used to detect the empty value and true value. For the usage please see the Wiki Tutorials.

See Also:
Constant Field Values

MODIFIER_CALL

public static final String MODIFIER_CALL
The modifier used to detect the method call invoked on the parent object. For the usage please see the Wiki Tutorials.

See Also:
Constant Field Values
Constructor Detail

DefaultSqlPlugins

public DefaultSqlPlugins()
Method Detail

isNotEmpty

public boolean isNotEmpty(String attributeName,
                          Object obj,
                          Object parentObj,
                          SqlMetaType sqlMetaType,
                          String inOutModifier,
                          boolean inSqlSetOrInsert,
                          Map<String,String> values,
                          Map<String,Object> features)
                   throws IllegalArgumentException
Used for the evaluation of the emptiness in the META SQL fragments.

Specified by:
isNotEmpty in interface IsEmptyPlugin
Parameters:
attributeName - the name of the input value
obj - the input value
parentObj - the parent of the input value
sqlMetaType - the internal type (= META type) devoted for the special processing of the input values
inOutModifier - the input/output value modifier devoted to extend the processing of the input/output values
inSqlSetOrInsert - an indicator the input value is evaluated in the CRUD statement (INSERT or SET)
values - values for a special identifier handling, for example a sequence for an identity
features - the optional features in the statement coontext
Returns:
the non-emptiness of the input value
Throws:
IllegalArgumentException

isTrue

public boolean isTrue(String attributeName,
                      Object obj,
                      Object parentObj,
                      SqlMetaType sqlMetaType,
                      String inOutModifier,
                      Map<String,String> values,
                      Map<String,Object> features)
Used for the evaluation of the logical expression in the conditional META SQL fragments.

Specified by:
isTrue in interface IsTruePlugin
Parameters:
attributeName - the name of the input value
obj - the input value
parentObj - the parent of the input value
sqlMetaType - the internal type (= META type) devoted for the special processing of the input values
inOutModifier - the input/output value modifier devoted to extend the processing of the input/output values
values - values for a special identifier handling, for example a sequence for an identity
features - the optional features in the statement coontext
Returns:
the boolean value of the logical expression

sqlCount

public String sqlCount(StringBuilder sql)
Used to construct the COUNT SQL.

Specified by:
sqlCount in interface SqlCountPlugin
Parameters:
sql - original META SQL
Returns:
the COUNT SQL

limitQuery

public SqlFromToPlugin.LimitType limitQuery(String queryString,
                                            StringBuilder queryResult,
                                            Integer firstResult,
                                            Integer maxResults,
                                            boolean ordered)
Used to construct the FROM-TO SQL.

Specified by:
limitQuery in interface SqlFromToPlugin
Parameters:
queryString - the original ANSI SQL
queryResult - the final ANSI SQL reflected FROM and TO restrictions
firstResult - The first SQL execution output row to be returned in the case we need to skip some rows in the result set. The primary usage is to support the pagination.
maxResults - The max number of SQL execution output rows, which can be returned in the result list. The primary usage is to support the pagination.
ordered - the SQL output is sorted
Returns:
the characteristic of FROM and TO restrictions used in SqlQuery.list()

callMethod

private Boolean callMethod(String attributeName,
                           Object parentObj,
                           Map<String,String> values)

limitQuery

private SqlFromToPlugin.LimitType limitQuery(String limitPattern,
                                             SqlFromToPlugin.LimitType limitType,
                                             String queryString,
                                             StringBuilder queryResult,
                                             Integer firstResult,
                                             Integer maxResults)

identitySelect

public String identitySelect(String identitySelectName,
                             String tableName,
                             String columnName)
Used to construct the identity SELECT SQL.

Specified by:
identitySelect in interface SqlIdentityPlugin
Parameters:
identitySelectName - the identity SELECT SQL name
tableName - the table name. Right now it's not supplied.
columnName - the column name. Right now it's not supplied.
Returns:
the final identity SELECT SQL

sequenceSelect

public String sequenceSelect(String sequenceName)
Used to construct the sequence SELECT SQL.

Specified by:
sequenceSelect in interface SqlSequencePlugin
Parameters:
sequenceName - the sequence name
Returns:
the final sequence SELECT SQL


Copyright © 2013. All Rights Reserved.