Package de.businesscode.bcdui.wrs.load
Class WrqQueryBuilder
- java.lang.Object
-
- de.businesscode.bcdui.wrs.load.WrqQueryBuilder
-
public class WrqQueryBuilder extends java.lang.Object
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
Fields Modifier and Type Field Description protected int
aliasCounter
protected Bindings
bindings
protected java.lang.String
jdbcResourceName
protected java.util.Map<java.lang.String,java.lang.Object>
queryGlobalStorage
protected java.util.Set<StandardBindingSet>
resolvedBindingSets
protected java.util.LinkedList<WrsBindingItem>
selectedBindingItems
protected Wrq2Sql
wrq2Sql
protected java.util.Map<java.lang.String,WrqBindingSet>
wrqBindingSetForWrqAlias
protected org.w3c.dom.Element
wrqElem
-
Constructor Summary
Constructors Constructor Description WrqQueryBuilder(Wrq2Sql wrq2Sql, Bindings bindings, org.w3c.dom.Element wrqElem)
We are initialized a single wrq:WrqRequest.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addCteBindingSetForWrqAlias(java.lang.String wrqAlias, WrqBindingSet bindingSet)
Set the BindingSet for a user provided table expression aliasjava.lang.Object
addToQueryGlobalStorage(java.lang.String key, java.lang.Object value)
Allows storing a query-wide valuevoid
assurePermittedOnAllResolvedBindingSets(BindingSet.SECURITY_OPS operation)
Make sure that all BindingSets we touch are allowed to be used for the current Principal for the operationBindings
getBindings()
Helps us use it in batch environments when not using Bindings.getInstance()WrqBindingSet
getCteBindingSetForWrqAlias(java.lang.String wrqAlias)
Get the BindingSet for a user provided table expression aliasjava.lang.Object
getFromQueryGlobalStorage(java.lang.String key)
Allows storing a query-wide valuejava.lang.String
getJdbcResourceName()
The database source name our query goes toint
getMaxRows()
java.lang.String
getNextCteTableSqlAlias()
Produce a new unique sql table alias for the current select scopejava.util.Set<StandardBindingSet>
getResolvedBindingSets()
The predefined BindingStets from WEB-INF/bindings we determined for this query, including BindingGroup resolutionjava.util.LinkedList<WrsBindingItem>
getSelectedBindingItems()
All BindingItems ever used in our query.SQLStatementWithParams
getSelectStatement()
Handles a "select-statement", i.e. a complete select (with-clause is currently not supported)boolean
hasCteBindingSetForWrqAlias(java.lang.String wrqAlias)
Set the BindingSet for a user provided table expression alias
-
-
-
Field Detail
-
wrq2Sql
protected final Wrq2Sql wrq2Sql
-
bindings
protected final Bindings bindings
-
wrqElem
protected final org.w3c.dom.Element wrqElem
-
selectedBindingItems
protected java.util.LinkedList<WrsBindingItem> selectedBindingItems
-
aliasCounter
protected int aliasCounter
-
wrqBindingSetForWrqAlias
protected java.util.Map<java.lang.String,WrqBindingSet> wrqBindingSetForWrqAlias
-
queryGlobalStorage
protected final java.util.Map<java.lang.String,java.lang.Object> queryGlobalStorage
-
resolvedBindingSets
protected java.util.Set<StandardBindingSet> resolvedBindingSets
-
jdbcResourceName
protected java.lang.String jdbcResourceName
-
-
Method Detail
-
getSelectStatement
public SQLStatementWithParams getSelectStatement()
Handles a "select-statement", i.e. a complete select (with-clause is currently not supported)- See Also:
ISqlGenerator.getSelectStatement()
-
getSelectedBindingItems
public java.util.LinkedList<WrsBindingItem> getSelectedBindingItems() throws java.lang.Exception
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:
java.lang.Exception
-
getCteBindingSetForWrqAlias
public WrqBindingSet getCteBindingSetForWrqAlias(java.lang.String wrqAlias)
Get the BindingSet for a user provided table expression alias- Parameters:
wrqAlias
-- Returns:
-
addCteBindingSetForWrqAlias
public void addCteBindingSetForWrqAlias(java.lang.String wrqAlias, WrqBindingSet bindingSet)
Set the BindingSet for a user provided table expression alias- Parameters:
wrqAlias
-bindingSet
-
-
hasCteBindingSetForWrqAlias
public boolean hasCteBindingSetForWrqAlias(java.lang.String wrqAlias)
Set the BindingSet for a user provided table expression alias- Parameters:
wrqAlias
-
-
getBindings
public Bindings getBindings()
Helps us use it in batch environments when not using Bindings.getInstance()- Returns:
-
getMaxRows
public int getMaxRows()
-
getResolvedBindingSets
public java.util.Set<StandardBindingSet> getResolvedBindingSets()
The predefined BindingStets from WEB-INF/bindings we determined for this query, including BindingGroup resolution- Returns:
-
getFromQueryGlobalStorage
public java.lang.Object getFromQueryGlobalStorage(java.lang.String key)
Allows storing a query-wide value- Parameters:
key
-- Returns:
-
addToQueryGlobalStorage
public java.lang.Object addToQueryGlobalStorage(java.lang.String key, java.lang.Object value)
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
public java.lang.String getNextCteTableSqlAlias()
Produce a new unique sql table alias for the current select scope- Returns:
-
getJdbcResourceName
public java.lang.String getJdbcResourceName()
The database source name our query goes to- Returns:
-
-