Package org.sqlproc.engine.plugin
Class DefaultSqlPlugins
java.lang.Object
org.sqlproc.engine.plugin.DefaultSqlPlugins
- All Implemented Interfaces:
IsEmptyPlugin,IsTruePlugin,Modifiers,SqlCountPlugin,SqlExecutionPlugin,SqlFromToPlugin,SqlIdentityPlugin,SqlProcessingIdPlugin,SqlSequencePlugin
public class DefaultSqlPlugins
extends Object
implements IsEmptyPlugin, IsTruePlugin, SqlCountPlugin, SqlFromToPlugin, SqlSequencePlugin, SqlIdentityPlugin, SqlExecutionPlugin, SqlProcessingIdPlugin
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
FieldsModifier and TypeFieldDescriptionprotected static final Stringstatic final Stringprotected static final String(package private) booleanprotected static final Stringprotected static final Stringprotected static final Stringprotected static final intprotected static final int(package private) final org.slf4j.LoggerThe internal slf4j logger.static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringprotected static final StringFields inherited from interface org.sqlproc.engine.plugin.Modifiers
MODIFIER_ANY, MODIFIER_ANYSET, MODIFIER_CALL, MODIFIER_DISCRIMINATOR, MODIFIER_EMPTY, MODIFIER_GTYPE, MODIFIER_ID, MODIFIER_IDENTITY_GENERATOR, MODIFIER_IDENTITY_SELECT, MODIFIER_NOTEMPTY, MODIFIER_NOTNULL, MODIFIER_NULL, MODIFIER_SEQUENCE, MODIFIER_TYPE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbeforeSqlExecution(String name, String queryString) Used to possible SQL query/command modification just before it is executed.private BooleancallMethod(SqlRuntimeContext runtimeCtx, String attributeName, Object parentObj, Map<String, String> values) getProcessingId(String name, Object dynamicInputValues, SqlControl sqlControl, Boolean useDynamicProcessingCache) Used to construct the unique ID of the executed statement based on the input values combination.identitySelect(SqlRuntimeContext runtimeCtx, String identitySelectName, Class<?> inputValueType) Used to construct the identity SELECT SQL.protected booleanbooleanisNotEmpty(SqlRuntimeContext runtimeCtx, String attributeName, Object obj, Object parentObj, SqlMetaType sqlMetaType, String inOutModifier, boolean inSqlSetOrInsert, Map<String, String> values) Used for the evaluation of the emptiness in the META SQL fragments.protected booleanisNotEmptyInternal(SqlRuntimeContext runtimeCtx, String attributeName, Object obj, Object parentObj, SqlMetaType sqlMetaType, String inOutModifier, boolean inSqlSetOrInsert, Map<String, String> values) Used for the evaluation of the emptiness in the META SQL fragments.booleanisTrue(SqlRuntimeContext runtimeCtx, String attributeName, Object obj, Object parentObj, SqlMetaType sqlMetaType, String inOutModifier, Map<String, String> values) Used for the evaluation of the logical expression in the conditional META SQL fragments.private SqlFromToPlugin.LimitTypelimitQuery(String limitPattern, SqlFromToPlugin.LimitType limitType, String queryString, StringBuilder queryResult, Integer firstResult, Integer maxResults) limitQuery(SqlRuntimeContext runtimeCtx, String queryString, StringBuilder queryResult, Integer firstResult, Integer maxResults, boolean ordered) Used to construct the FROM-TO SQL.sequenceSelect(SqlRuntimeContext runtimeCtx, String sequenceName) Used to construct the sequence SELECT SQL.String[]sqlCount(String name, StringBuilder sql) Used to construct the COUNT SQL.
-
Field Details
-
logger
final org.slf4j.Logger loggerThe internal slf4j logger. -
METHOD_IS_NULL
- See Also:
-
METHOD_IS_NULL_
- See Also:
-
METHOD_IS_DEF
- See Also:
-
METHOD_IS_DEF_
- See Also:
-
METHOD_TO_INIT
- See Also:
-
METHOD_TO_INIT_
- See Also:
-
debug
boolean debug -
ID
- See Also:
-
L_ID
protected static final int L_ID -
FROM
- See Also:
-
SELECT
- See Also:
-
L_SELECT
protected static final int L_SELECT -
DISTINCT
- See Also:
-
CMD_DISTINCT
- See Also:
-
COUNT_COLNAME
- See Also:
-
COUNT_TYPE
- See Also:
-
-
Constructor Details
-
DefaultSqlPlugins
public DefaultSqlPlugins()
-
-
Method Details
-
isNotEmpty
public boolean isNotEmpty(SqlRuntimeContext runtimeCtx, String attributeName, Object obj, Object parentObj, SqlMetaType sqlMetaType, String inOutModifier, boolean inSqlSetOrInsert, Map<String, String> values) throws IllegalArgumentExceptionUsed for the evaluation of the emptiness in the META SQL fragments.- Specified by:
isNotEmptyin interfaceIsEmptyPlugin- Parameters:
runtimeCtx- the public runtime contextattributeName- the name of the input valueobj- the input valueparentObj- the parent of the input valuesqlMetaType- the internal type (= META type) devoted for the special processing of the input valuesinOutModifier- the input/output value modifier devoted to extend the processing of the input/output valuesinSqlSetOrInsert- 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- Returns:
- the non-emptiness of the input value
- Throws:
IllegalArgumentException
-
isNotEmptyInternal
protected boolean isNotEmptyInternal(SqlRuntimeContext runtimeCtx, String attributeName, Object obj, Object parentObj, SqlMetaType sqlMetaType, String inOutModifier, boolean inSqlSetOrInsert, Map<String, String> values) throws IllegalArgumentExceptionUsed for the evaluation of the emptiness in the META SQL fragments.- Parameters:
runtimeCtx- the public runtime contextattributeName- the name of the input valueobj- the input valueparentObj- the parent of the input valuesqlMetaType- the internal type (= META type) devoted for the special processing of the input valuesinOutModifier- the input/output value modifier devoted to extend the processing of the input/output valuesinSqlSetOrInsert- 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- Returns:
- the non-emptiness of the input value
- Throws:
IllegalArgumentException
-
isEmpty
-
isTrue
public boolean isTrue(SqlRuntimeContext runtimeCtx, String attributeName, Object obj, Object parentObj, SqlMetaType sqlMetaType, String inOutModifier, Map<String, String> values) Used for the evaluation of the logical expression in the conditional META SQL fragments.- Specified by:
isTruein interfaceIsTruePlugin- Parameters:
runtimeCtx- the public runtime contextattributeName- the name of the input valueobj- the input valueparentObj- the parent of the input valuesqlMetaType- the internal type (= META type) devoted for the special processing of the input valuesinOutModifier- the input/output value modifier devoted to extend the processing of the input/output valuesvalues- values for a special identifier handling, for example a sequence for an identity- Returns:
- the boolean value of the logical expression
-
sqlCount
Used to construct the COUNT SQL.- Specified by:
sqlCountin interfaceSqlCountPlugin- Parameters:
name- Name of the META SQL query or statementsql- original META SQL- Returns:
- the COUNT SQL and COUNT column
-
limitQuery
public SqlFromToPlugin.LimitType limitQuery(SqlRuntimeContext runtimeCtx, String queryString, StringBuilder queryResult, Integer firstResult, Integer maxResults, boolean ordered) Used to construct the FROM-TO SQL.- Specified by:
limitQueryin interfaceSqlFromToPlugin- Parameters:
runtimeCtx- the public runtime contextqueryString- the original ANSI SQLqueryResult- the final ANSI SQL reflected FROM and TO restrictionsfirstResult- 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(SqlRuntimeContext)
-
callMethod
-
limitQuery
private SqlFromToPlugin.LimitType limitQuery(String limitPattern, SqlFromToPlugin.LimitType limitType, String queryString, StringBuilder queryResult, Integer firstResult, Integer maxResults) -
identitySelect
public String identitySelect(SqlRuntimeContext runtimeCtx, String identitySelectName, Class<?> inputValueType) Used to construct the identity SELECT SQL.- Specified by:
identitySelectin interfaceSqlIdentityPlugin- Parameters:
runtimeCtx- the public runtime contextidentitySelectName- the identity SELECT SQL nameinputValueType- a dynamic input value Java type- Returns:
- the final identity SELECT SQL
-
sequenceSelect
Used to construct the sequence SELECT SQL.- Specified by:
sequenceSelectin interfaceSqlSequencePlugin- Parameters:
runtimeCtx- the public runtime contextsequenceName- the sequence name- Returns:
- the final sequence SELECT SQL
-
beforeSqlExecution
Used to possible SQL query/command modification just before it is executed.- Specified by:
beforeSqlExecutionin interfaceSqlExecutionPlugin- Parameters:
name- Name of the META SQL query or statementqueryString- the SQL query command- Returns:
- the SQL query command, which is going to be executed
-
getProcessingId
public String getProcessingId(String name, Object dynamicInputValues, SqlControl sqlControl, Boolean useDynamicProcessingCache) Used to construct the unique ID of the executed statement based on the input values combination.- Specified by:
getProcessingIdin interfaceSqlProcessingIdPlugin- Parameters:
name- Name of the META SQL query or statementdynamicInputValues- the SQL statement dynamic parameters (input values)sqlControl- The compound parameters controlling the META SQL execution- Returns:
- the unique ID for processing case
-