Class ResettableScpContext
- All Implemented Interfaces:
de.calamanari.adl.ProcessContext,SqlConversionProcessContext
SqlConversionProcessContext.
This class covers the state of an AbstractSqlExpressionConverter instance throughout its lifetime.
It allows to reset this state to an initial configuration before each conversion run, so multiple runs won't interfere.
- Author:
- Karl Eilebrecht
-
Constructor Summary
ConstructorsConstructorDescriptionResettableScpContext(DataBinding dataBinding, Map<String, Serializable> globalVariablesTemplate, Set<de.calamanari.adl.Flag> flagsTemplate) -
Method Summary
Modifier and TypeMethodDescriptionSet<de.calamanari.adl.Flag> Set<de.calamanari.adl.Flag> The main table is the table to start the query with.de.calamanari.adl.FormatStylegetStyle()voidregisterParameter(QueryParameter parameter) Registers a query parameter of the current query.voidreset()Initializes this context, so its state has the initially configured flags and variables againvoidsetAliasHelper(AliasHelper aliasHelper) voidsetAugmentationListener(SqlAugmentationListener augmentationListener) Sets the augmentation listener for this instance, default isSqlAugmentationListener.none()voidsetConditionFactory(MatchConditionFactory conditionFactory) voidsetExpressionHelper(CoreExpressionSqlHelper expressionHelper) voidsetIdColumnName(String idColumnName) voidsetMainTable(TableMetaInfo mainTable) The main table is the table to start the query with.voidsetQueryType(QueryType queryType) voidsetStyle(de.calamanari.adl.FormatStyle style) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.calamanari.adl.sql.cnv.SqlConversionProcessContext
getMainIdColumnName
-
Constructor Details
-
ResettableScpContext
public ResettableScpContext(DataBinding dataBinding, Map<String, Serializable> globalVariablesTemplate, Set<de.calamanari.adl.Flag> flagsTemplate) - Parameters:
dataBinding- to be set initially for each conversion runflagsTemplate- to be set initially for each conversion run
-
-
Method Details
-
reset
public void reset()Initializes this context, so its state has the initially configured flags and variables againBecause we assume them to be rather stable once configured, the following properties won't be reset by this method:
setStyle(FormatStyle)idColumnNamesetQueryType(QueryType)
-
getGlobalVariables
- Specified by:
getGlobalVariablesin interfacede.calamanari.adl.ProcessContext
-
getGlobalFlags
- Specified by:
getGlobalFlagsin interfacede.calamanari.adl.ProcessContext
-
getGlobalVariablesTemplate
- Returns:
- the variables specified at construction time (this config acts as a template during
reset())
-
getGlobalFlagsTemplate
- Returns:
- the flags specified at construction time (this config acts as a template during
reset())
-
getDataBinding
- Specified by:
getDataBindingin interfaceSqlConversionProcessContext- Returns:
- the configured data binding of the converter
-
registerParameter
Description copied from interface:SqlConversionProcessContextRegisters a query parameter of the current query.Only registered parameters can later be applied to the final script.
- Specified by:
registerParameterin interfaceSqlConversionProcessContext- Parameters:
parameter-
-
getRegisteredParameters
- Specified by:
getRegisteredParametersin interfaceSqlConversionProcessContext- Returns:
- list of all parameters registered during the current conversion run
- See Also:
-
getAliasHelper
- Specified by:
getAliasHelperin interfaceSqlConversionProcessContext- Returns:
- the converter's alias helper to create and maintain aliases
-
setAliasHelper
- Parameters:
aliasHelper- the converter's alias helper to create and maintain aliases
-
getExpressionHelper
- Specified by:
getExpressionHelperin interfaceSqlConversionProcessContext- Returns:
- the converter's expression helper to work with expressions and sub-expressions
-
setExpressionHelper
- Parameters:
expressionHelper- the converter's expression helper to work with expressions and sub-expressions
-
getIdColumnName
- Specified by:
getIdColumnNamein interfaceSqlConversionProcessContext- Returns:
- configured name of the main ID-column (when selecting IDs), defaults to
SqlFormatConstants.DEFAULT_ID_COLUMN_NAME
-
setIdColumnName
- Parameters:
idColumnName- name of the main ID-column (when selecting IDs), defaults toSqlFormatConstants.DEFAULT_ID_COLUMN_NAME
-
getQueryType
- Specified by:
getQueryTypein interfaceSqlConversionProcessContext- Returns:
- type of the query to be created, defaults to
QueryType.SELECT_DISTINCT_ID_ORDERED
-
setQueryType
- Parameters:
queryType- type of the query to be created, defaults toQueryType.SELECT_DISTINCT_ID_ORDERED
-
getMainTable
Description copied from interface:SqlConversionProcessContextThe main table is the table to start the query with. It is initialized withDataTableConfig.primaryTable().Depending on the conversion strategy it can be reasonable to override it with a different table, for example if only a single table is involved without any complex joins.
- Specified by:
getMainTablein interfaceSqlConversionProcessContext- Returns:
- the main table or null if not configured
-
setMainTable
The main table is the table to start the query with. It is initialized withDataTableConfig.primaryTable().Depending on the conversion strategy it can be reasonable to override it with a different table, for example if only a single table is involved without any complex joins.
- Parameters:
mainTable- the table to prefer to start the query or null to enforce another query start strategy
-
getConditionFactory
- Specified by:
getConditionFactoryin interfaceSqlConversionProcessContext- Returns:
- the factory for creating match conditions on target columns, set by the converter per conversion run
-
setConditionFactory
- Parameters:
conditionFactory- the factory for creating match conditions on target columns, set by the converter per conversion run
-
getStyle
public de.calamanari.adl.FormatStyle getStyle()- Specified by:
getStylein interfaceSqlConversionProcessContext- Returns:
- configured formatting style (inline or multi-line)
-
setStyle
public void setStyle(de.calamanari.adl.FormatStyle style) - Parameters:
style- formatting style (inline or multi-line), default isFormatStyle.PRETTY_PRINT
-
getAugmentationListener
- Returns:
- the configured augmentation listener or
SqlAugmentationListener.none()
-
setAugmentationListener
Sets the augmentation listener for this instance, default isSqlAugmentationListener.none()- Parameters:
augmentationListener-
-
getWhereClause
- Specified by:
getWhereClausein interfaceSqlConversionProcessContext- Returns:
- WHERE-clause builder of the converter
-
getAliasesInWhereClause
- Specified by:
getAliasesInWhereClausein interfaceSqlConversionProcessContext- Returns:
- list of all aliases referenced in the where-clause, mutable
-
getTablesInWhereClause
- Specified by:
getTablesInWhereClausein interfaceSqlConversionProcessContext- Returns:
- list of all tables referenced in the where-clause, mutable
-