Package overit.geocall.da
Class CommandContext
java.lang.Object
overit.geocall.da.CommandContext
Class that defines a context of operation of each command associated with a DAO.
Each object will contain a
In addition to filters and values, the context may contain other parameters, such as the maximum number of rows to extract or the number of rows to skip for select commands; moreover the context will contain, at the end of the execution of the associated command, the result obtained.
Command and can have filters and / or values,
that are the maps that will be used by DAO to determine the SQL code,
through the inferential rules contained in it. In addition to filters and values, the context may contain other parameters, such as the maximum number of rows to extract or the number of rows to skip for select commands; moreover the context will contain, at the end of the execution of the associated command, the result obtained.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected Commandprotected DBStatementObserverprotected intprotected Stringprotected Objectprotected intprotected Sql -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdds one or more key / value pairs to the filtersAdds one or more key / value pairs to the valuesReturns theCommandassociated to this contextReturns the filter of the contextintReturn the maximum number of rows that can be extracted with the queries of this CommandContextgetOrder()Returns the string that can be used to define a particular sorting.Returns the map that is the result of the merge of the filters and values map and in which for each filter field name the string F: is prefixed and for each values field name the string V: is prefixed, to avoid conflictsReturns the result of the commandgetSequenceNextVal(PoolKit poolKit, String table, String sequence) Returns aLongabout the sequence value.intReturn the number of rows that must be skipped for the queries of this CommandContextgetSql()Returns the SQL code of this contextReturns theDBStatementObserverused by the context to notify the operating phases of theDBStatementReturns the values of the contextvoidsetCommand(Command command) Sets theCommandto this contextSets the filter for the contextsetMaxRows(int maxRows) Sets the maximum number of rows that can be extracted with the queries of this CommandContextSets a string that can be used by theDAO, in particular by theDAO.getOrder(overit.geocall.da.CommandContext)method, to specify a particular sorting; it can be a control field (lowercase), a list of fields (uppercase), etc.Sets a String starting from the Order object passed as parameter.
It can be used by theDAO, in particular by theDAO.getOrder(overit.geocall.da.CommandContext)method, to specify a particular sorting
How to use this string depends on the specific implementation and instance of DAOvoidSets the parametersvoidSets the result of the commandvoidsetSequenceNextVal(Long sequenceNextVal) Sets the sequence value required to perform aninsertusing theDAO.setSkipRows(int skipRows) Sets the number of rows that must be skipped for the queries of this CommandContextvoidSets the SQL code of this contextvoidSets theDBStatementObserverused by the context to notify the operating phases of theDBStatementSets the values for the context
-
Field Details
-
_filter
-
_values
-
_params
-
_maxRows
protected int _maxRows -
_skipRows
protected int _skipRows -
_order
-
_dbso
-
_command
-
_sql
-
_result
-
-
Constructor Details
-
CommandContext
Creates a new instance of CommandContext- Parameters:
c- TheCommandassociated to the context
-
-
Method Details
-
getFilter
Returns the filter of the context- Returns:
- The
Mapthat contains the key / value pairs (where the keys are field names or control variables) that will be used as filters by the command
-
setFilter
Sets the filter for the context- Parameters:
filter- AnMapthat contains the key / value pairs (where the keys are field names or control variables) that will be used as filters by the command- Returns:
- This instance of CommandContext with the given filter
-
addFilter
Adds one or more key / value pairs to the filters- Parameters:
pairs- The pairs to add to the filter map- Returns:
- This instance of CommandContext with the filter added
-
getValues
Returns the values of the context- Returns:
- The
Mapthat contains the key / value pairs (where the keys are field) that will be used as values by the command
-
setValues
Sets the values for the context- Parameters:
values- AnMapthat contains the key / value pairs (where the keys are field names or control variables) that will be used as values by the command- Returns:
- This instance of CommandContext with the given values
-
addValues
Adds one or more key / value pairs to the values- Parameters:
pairs- The pairs to add to the values map- Returns:
- This instance of CommandContext with the values added
-
getParams
Returns the map that is the result of the merge of the filters and values map and in which for each filter field name the string F: is prefixed and for each values field name the string V: is prefixed, to avoid conflicts- Returns:
- The
Mapcontaining the parameters
-
setParams
Sets the parameters- Parameters:
params- TheHashMapthat is the result of the merge of the filters and values map and in which for each filter field name the string F: is prefixed and for each values field name the string V: is prefixed
-
getMaxRows
public int getMaxRows()Return the maximum number of rows that can be extracted with the queries of this CommandContext- Returns:
- The int that represent the maximum number of rows that can be extracted with the queries
-
setMaxRows
Sets the maximum number of rows that can be extracted with the queries of this CommandContext- Parameters:
maxRows- The maximum number of rows- Returns:
- This instance of CommandContext with the given attribute
-
getSkipRows
public int getSkipRows()Return the number of rows that must be skipped for the queries of this CommandContext- Returns:
- The int that represent the number of rows that must be skipped for the queries
-
setSkipRows
Sets the number of rows that must be skipped for the queries of this CommandContext- Parameters:
skipRows- The number of rows to skip- Returns:
- This instance of CommandContext with the given attribute
-
getOrder
Returns the string that can be used to define a particular sorting. How to use this string depends on the specific implementation and instance of DAO- Returns:
- The string that can define a particular sorting; it can be a control field (lowercase), a list of fields (uppercase), etc.
-
setOrder
Sets a string that can be used by theDAO, in particular by theDAO.getOrder(overit.geocall.da.CommandContext)method, to specify a particular sorting; it can be a control field (lowercase), a list of fields (uppercase), etc. How to use this string depends on the specific implementation and instance of DAO- Parameters:
order- A string that can define a particular sorting- Returns:
- This instance of CommandContext with the given attribute
-
setOrder
Sets a String starting from the Order object passed as parameter.
It can be used by theDAO, in particular by theDAO.getOrder(overit.geocall.da.CommandContext)method, to specify a particular sorting
How to use this string depends on the specific implementation and instance of DAO- Parameters:
order- An object that can define a particular sorting- Returns:
- This instance of CommandContext with the given attribute
-
getCommand
Returns theCommandassociated to this context- Returns:
- The
Commandassociated to this context
-
setCommand
Sets theCommandto this context- Parameters:
command- TheCommandto set to this context
-
getSql
Returns the SQL code of this context- Returns:
- The
Sqlobject that defines the SQL code for this context
-
setSql
Sets the SQL code of this context- Parameters:
sql- TheSqlobject that defines the SQL code for this context
-
getStatementObserver
Returns theDBStatementObserverused by the context to notify the operating phases of theDBStatement- Returns:
- The instance of
DBStatementObserver
-
setStatementObserver
Sets theDBStatementObserverused by the context to notify the operating phases of theDBStatement- Parameters:
dbso- The instance ofDBStatementObserverto set
-
getResult
Returns the result of the command- Returns:
- The object that defines the result of the command (it can be a
DBView) or an integer
-
setResult
Sets the result of the command- Parameters:
result- The object that defines the result of the command (it can be aDBView) or an integer
-
setSequenceNextVal
Sets the sequence value required to perform aninsertusing theDAO.- Parameters:
sequenceNextVal-Longabout the sequence value.
-
getSequenceNextVal
Returns aLongabout the sequence value.- Returns:
- a
Longabout the sequence value. - Throws:
DAException
-