Class WrqBindingItem

java.lang.Object
de.businesscode.bcdui.wrs.load.WrqBindingItem
All Implemented Interfaces:
WrsBindingItem

public class WrqBindingItem extends Object implements WrsBindingItem
Represents a BindingItem in a Wrq, it is it has knowledge of the underlying BindingItem and the current query There can be multiple WrqBindingItem for a BindingItem(FromRel), to reflect different behaviora like aggr for example in select and in grouping clause
  • Field Details

  • Constructor Details

    • WrqBindingItem

      protected WrqBindingItem(WrqInfo wrqInfo, Element elem, String alias, boolean enforceAggr) throws Exception
      Used to derive a BindingItem from a wrs:C, it is combined with the info from the BindingSet but the WrsRequest provided info wins in case of conflict
      Throws:
      Exception
    • WrqBindingItem

      protected WrqBindingItem(WrqInfo wrqInfo, Element elem, String alias, boolean enforceAggr, WrqBindingItem parentWrqC) throws Exception
      Used to derive a BindingItem from a wrs:C/wrs:A, it is combined with the info from the BindingSet but the WrsRequest provided info wins in case of conflict If parentWrqC is not null, then this is a wrs:A
      Parameters:
      wrqInfo -
      elem -
      alias -
      enforceAggr -
      parentWrqC -
      Throws:
      Exception
    • WrqBindingItem

      protected WrqBindingItem(WrqInfo wrqInfo, String wrsAName, String aggr, String alias, WrqBindingItem parentC, String columnExpression)
      Used for creating an artificial wrs:A attribute
      Parameters:
      wrqInfo -
      wrsAName -
      aggr -
      alias -
      parentC -
      columnExpression -
    • WrqBindingItem

      protected WrqBindingItem(WrqInfo wrqInfo, String id, BindingItem bi, String alias, boolean enforceAggr)
      Used for creating a BindingItem from the info of a BindingSet
      Parameters:
      wrqInfo -
      bi -
      alias -
      enforceAggr -
  • Method Details

    • getDefaultAggr

      protected static String getDefaultAggr(int dataType)
      Usually, the aggregation is defined in the Wrq Element e for the column. There are two cases where not: is not given (select all, no select list), or the attribute is simply not set. Then we have this mechanism for default-aggregator 1) Wrq/Columns/C/@aggr 2) BindingSet/BindingItem/@aggr 3) MAX() or SUM() depending on the BindingItems data type
      Parameters:
      dataType -
      Returns:
    • getAlias

      public String getAlias()
      Specified by:
      getAlias in interface WrsBindingItem
    • getColumnNumber

      public int getColumnNumber()
      Specified by:
      getColumnNumber in interface WrsBindingItem
    • setColumnNumber

      public void setColumnNumber(int columnNumber)
    • isEscapeXML

      public Boolean isEscapeXML()
      Specified by:
      isEscapeXML in interface WrsBindingItem
    • toXML

      public void toXML(XMLStreamWriter writer, boolean withColumnExpression) throws XMLStreamException
      Specified by:
      toXML in interface WrsBindingItem
      Throws:
      XMLStreamException
    • hasWrsAAttributes

      public boolean hasWrsAAttributes()
      Specified by:
      hasWrsAAttributes in interface WrsBindingItem
    • getWrsAAttributes

      public Collection<WrsBindingItem> getWrsAAttributes()
      Specified by:
      getWrsAAttributes in interface WrsBindingItem
    • addWrsAAttribute

      public void addWrsAAttribute(WrqBindingItem wrsAttr)
    • getJDBCDataType

      public Integer getJDBCDataType()
      Specified by:
      getJDBCDataType in interface WrsBindingItem
    • getWrsAName

      public String getWrsAName()
      Specified by:
      getWrsAName in interface WrsBindingItem
    • getId

      public String getId()
      Specified by:
      getId in interface WrsBindingItem
    • getAggr

      public String getAggr()
    • isOrderByDescending

      public boolean isOrderByDescending()
    • setOrderByDescending

      public void setOrderByDescending(boolean isDescending)
    • getSplitColumnExpression

      public List<String> getSplitColumnExpression()
      Used to identify column reference parts in a SQL Column expressions to allow for prepending table alias
      Returns:
    • getSplitColumnExpression

      public List<String> getSplitColumnExpression(boolean applyVdm)
      Used to identify column reference parts in a SQL Column expressions to allow for prepending table alias
      Parameters:
      applyVdm - If false, virtual dimension member caused case-when are ignored here
      Returns:
    • getQColumnExpressionWithAggr

      public String getQColumnExpressionWithAggr() throws BindingNotFoundException
      Returns the column expression with table alias and with aggregation applied, if any is set
      Returns:
      Throws:
      BindingNotFoundException
    • getQColumnExpressionWithAggr

      public String getQColumnExpressionWithAggr(boolean enforceAggr) throws BindingNotFoundException
      Returns the column expression with table alias and with aggregation applied, if any is set or if enforceAggr=true
      Returns:
      Throws:
      BindingNotFoundException
    • getColumnExpressionWithAggr

      public String getColumnExpressionWithAggr()
      Returns the column expression with aggregation applied, if any is set
      Returns:
    • getColumnExpressionWithAggr

      public String getColumnExpressionWithAggr(boolean enforceAggr)
      Returns the column expression with aggregation applied, if any is set or if enforceAggr=true
      Returns:
    • hasAColumnReference

      public boolean hasAColumnReference()
    • getQColumnExpression

      public String getQColumnExpression() throws BindingNotFoundException
      Return the column expression with the table alias
      Returns:
      Throws:
      BindingNotFoundException
    • getQColumnExpression

      public String getQColumnExpression(boolean applyVdm) throws BindingNotFoundException
      Return the column expression with the table alias
      Parameters:
      applyVdm - If false, virtual dimension members are ignored here
      Returns:
      Throws:
      BindingNotFoundException
    • getColumnExpression

      public String getColumnExpression()
      Return the physical DB column expression including virtual dimension member caused adjustments
      Returns:
    • setColumnExpression

      public void setColumnExpression(String cE)
      Derive the column expression< Note that for VDM, this relies on plainColumnExpression and jdbcDataType being set already to this.
      Parameters:
      cE -
    • getTableAlias

      public List<String> getTableAlias() throws BindingNotFoundException
      Usually the table alias is derived from the wrq-table alias with which this bindingItem is referenced b.country will be taken from the table that is associated with the wrq table alias "b" This value is created during each query. But here are two special cases: tableAliasOverwrite allows to completely ignore this and fix out table alias by using setTableAliasOverwrite(). This is used for CTE fo example tableAliasPostFix will be not empty in case the BindingItem comes from a Relation as it mist be the Relation-joined (as opposed to Wrq-joined) table
      Returns:
      Throws:
      BindingNotFoundException
    • getParentWrsC

      public WrqBindingItem getParentWrsC()
    • getCaption

      public String getCaption()
      Specified by:
      getCaption in interface WrsBindingItem
    • getJDBCColumnScale

      public String getJDBCColumnScale()
      Specified by:
      getJDBCColumnScale in interface WrsBindingItem
    • getBoundVariables

      public List<Element> getBoundVariables()
    • getSkipForTotals

      public String getSkipForTotals()
    • getReferenceBindingItem

      public BindingItem getReferenceBindingItem()
      Returns:
      a BindingItem this item is referencing, maybe null in case this is a virtual item
    • isNumeric

      public boolean isNumeric()
      Returns:
      true if the BindingItem represents a numeric value
    • getAttribute

      public Object getAttribute(String name)
    • setTableAliasOverwrite

      public void setTableAliasOverwrite(String tableAlias)