Package de.businesscode.bcdui.wrs.load
Class WrqQueryBuilder
java.lang.Object
de.businesscode.bcdui.wrs.load.WrqQueryBuilder
Takes a full Wrq query, formally a "select-statement" and generates SQL from it
[WITH]* SELECT [UNION SELECT]* [ORDER BY]
Children can be recursive full-selects or a sub-selects or it is an empty (no select at all) or a meta-data request (endRow==0 )
One instance of this class only handles one Wrq
NOTE: We do not check the rights, use assurePermittedOnAllResolvedBindingSets() for verifying this
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected int
protected final Bindings
protected String
protected Set<StandardBindingSet>
protected LinkedList<WrsBindingItem>
protected final Wrq2Sql
protected Map<String,
WrqBindingSet> protected final Element
-
Constructor Summary
ConstructorsConstructorDescriptionWrqQueryBuilder
(Wrq2Sql wrq2Sql, Bindings bindings, Element wrqElem) We are initialized a single wrq:WrqRequest. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addCteBindingSetForWrqAlias
(String wrqAlias, WrqBindingSet bindingSet) Set the BindingSet for a user provided table expression aliasaddToQueryGlobalStorage
(String key, Object value) Allows storing a query-wide valuevoid
Make sure that all BindingSets we touch are allowed to be used for the current Principal for the operationHelps us use it in batch environments when not using Bindings.getInstance()getCteBindingSetForWrqAlias
(String wrqAlias) Get the BindingSet for a user provided table expression aliasAllows storing a query-wide valueThe database source name our query goes toint
Produce a new unique sql table alias for the current select scopeThe predefined BindingStets from WEB-INF/bindings we determined for this query, including BindingGroup resolutionAll BindingItems ever used in our query.Handles a "select-statement", i.e. a complete select (with-clause is currently not supported)boolean
hasCteBindingSetForWrqAlias
(String wrqAlias) Set the BindingSet for a user provided table expression alias
-
Field Details
-
wrq2Sql
-
bindings
-
wrqElem
-
selectedBindingItems
-
aliasCounter
protected int aliasCounter -
wrqBindingSetForWrqAlias
-
queryGlobalStorage
-
resolvedBindingSets
-
jdbcResourceName
-
-
Constructor Details
-
WrqQueryBuilder
We are initialized a single wrq:WrqRequest.- Throws:
Exception
-
-
Method Details
-
getSelectStatement
Handles a "select-statement", i.e. a complete select (with-clause is currently not supported)- See Also:
-
getSelectedBindingItems
All BindingItems ever used in our query. Needed in cases when the selected BindingSet depends on it, which is in only the case for a single plain SELECT.- Returns:
- Throws:
Exception
-
getCteBindingSetForWrqAlias
Get the BindingSet for a user provided table expression alias- Parameters:
wrqAlias
-- Returns:
-
addCteBindingSetForWrqAlias
Set the BindingSet for a user provided table expression alias- Parameters:
wrqAlias
-bindingSet
-
-
hasCteBindingSetForWrqAlias
Set the BindingSet for a user provided table expression alias- Parameters:
wrqAlias
-
-
getBindings
Helps us use it in batch environments when not using Bindings.getInstance()- Returns:
-
getMaxRows
public int getMaxRows() -
getResolvedBindingSets
The predefined BindingStets from WEB-INF/bindings we determined for this query, including BindingGroup resolution- Returns:
-
getFromQueryGlobalStorage
Allows storing a query-wide value- Parameters:
key
-- Returns:
-
addToQueryGlobalStorage
Allows storing a query-wide value- Parameters:
key
-- Returns:
-
assurePermittedOnAllResolvedBindingSets
public void assurePermittedOnAllResolvedBindingSets(BindingSet.SECURITY_OPS operation) throws SecurityException Make sure that all BindingSets we touch are allowed to be used for the current Principal for the operation- Parameters:
operation
-- Throws:
SecurityException
-
getNextCteTableSqlAlias
Produce a new unique sql table alias for the current select scope- Returns:
-
getJdbcResourceName
The database source name our query goes to- Returns:
-