Class WrqQueryBuilder

java.lang.Object
de.businesscode.bcdui.wrs.load.WrqQueryBuilder

public class WrqQueryBuilder extends 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 Details

  • Constructor Details

  • Method Details

    • getSelectStatement

      public SQLStatementWithParams getSelectStatement()
      Handles a "select-statement", i.e. a complete select (with-clause is currently not supported)
      See Also:
    • getSelectedBindingItems

      public LinkedList<WrsBindingItem> getSelectedBindingItems() throws 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:
      Exception
    • getCteBindingSetForWrqAlias

      public WrqBindingSet getCteBindingSetForWrqAlias(String wrqAlias)
      Get the BindingSet for a user provided table expression alias
      Parameters:
      wrqAlias -
      Returns:
    • addCteBindingSetForWrqAlias

      public void addCteBindingSetForWrqAlias(String wrqAlias, WrqBindingSet bindingSet)
      Set the BindingSet for a user provided table expression alias
      Parameters:
      wrqAlias -
      bindingSet -
    • hasCteBindingSetForWrqAlias

      public boolean hasCteBindingSetForWrqAlias(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 Set<StandardBindingSet> getResolvedBindingSets()
      The predefined BindingStets from WEB-INF/bindings we determined for this query, including BindingGroup resolution
      Returns:
    • getFromQueryGlobalStorage

      public Object getFromQueryGlobalStorage(String key)
      Allows storing a query-wide value
      Parameters:
      key -
      Returns:
    • addToQueryGlobalStorage

      public Object addToQueryGlobalStorage(String key, 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 String getNextCteTableSqlAlias()
      Produce a new unique sql table alias for the current select scope
      Returns:
    • getJdbcResourceName

      public String getJdbcResourceName()
      The database source name our query goes to
      Returns: