Package de.businesscode.bcdui.wrs.load
Class WrqBindingItem
- java.lang.Object
-
- de.businesscode.bcdui.wrs.load.WrqBindingItem
-
- All Implemented Interfaces:
WrsBindingItem
public class WrqBindingItem extends java.lang.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 Summary
Fields Modifier and Type Field Description protected java.util.Map<java.lang.String,java.lang.Object>
attributes
-
Constructor Summary
Constructors Modifier Constructor Description protected
WrqBindingItem(WrqInfo wrqInfo, java.lang.String id, BindingItem bi, java.lang.String alias, boolean enforceAggr)
Used for creating a BindingItem from the info of a BindingSetprotected
WrqBindingItem(WrqInfo wrqInfo, java.lang.String wrsAName, java.lang.String aggr, java.lang.String alias, WrqBindingItem parentC, java.lang.String columnExpression)
Used for creating an artificial wrs:A attributeprotected
WrqBindingItem(WrqInfo wrqInfo, org.w3c.dom.Element elem, java.lang.String alias, boolean enforceAggr)
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 conflictprotected
WrqBindingItem(WrqInfo wrqInfo, org.w3c.dom.Element elem, java.lang.String alias, boolean enforceAggr, WrqBindingItem parentWrqC)
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
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addWrsAAttribute(WrqBindingItem wrsAttr)
java.lang.String
getAggr()
java.lang.String
getAlias()
java.lang.Object
getAttribute(java.lang.String name)
java.util.List<org.w3c.dom.Element>
getBoundVariables()
java.lang.String
getCaption()
java.lang.String
getColumnExpression()
Return the physical DB column expression including virtual dimension member caused adjustmentsjava.lang.String
getColumnExpressionWithAggr()
Returns the column expression with aggregation applied, if any is setjava.lang.String
getColumnExpressionWithAggr(boolean enforceAggr)
Returns the column expression with aggregation applied, if any is set or if enforceAggr=trueint
getColumnNumber()
protected static java.lang.String
getDefaultAggr(int dataType)
Usually, the aggregation is defined in the Wrq Element e for the column.java.lang.String
getId()
java.lang.String
getJDBCColumnScale()
java.lang.Integer
getJDBCDataType()
WrqBindingItem
getParentWrsC()
java.lang.String
getQColumnExpression()
Return the column expression with the table aliasjava.lang.String
getQColumnExpression(boolean applyVdm)
Return the column expression with the table aliasjava.lang.String
getQColumnExpressionWithAggr()
Returns the column expression with table alias and with aggregation applied, if any is setjava.lang.String
getQColumnExpressionWithAggr(boolean enforceAggr)
Returns the column expression with table alias and with aggregation applied, if any is set or if enforceAggr=trueBindingItem
getReferenceBindingItem()
java.lang.String
getSkipForTotals()
java.util.List<java.lang.String>
getSplitColumnExpression()
Used to identify column reference parts in a SQL Column expressions to allow for prepending table alias {@see BindingUtils.splitColumnExpression}java.util.List<java.lang.String>
getSplitColumnExpression(boolean applyVdm)
Used to identify column reference parts in a SQL Column expressions to allow for prepending table alias {@see BindingUtils.splitColumnExpression}java.lang.String
getTableAlias()
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.java.util.Collection<WrsBindingItem>
getWrsAAttributes()
java.lang.String
getWrsAName()
boolean
hasAColumnReference()
boolean
hasWrsAAttributes()
java.lang.Boolean
isEscapeXML()
boolean
isNumeric()
boolean
isOrderByDescending()
void
setColumnExpression(java.lang.String cE)
Derive the column expression< Note that for VDM, this relies on plainColumnExpression and jdbcDataType being set already to this.void
setColumnNumber(int columnNumber)
void
setOrderByDescending(boolean isDescending)
void
setTableAliasOverwrite(java.lang.String tableAlias)
void
toXML(javax.xml.stream.XMLStreamWriter writer, boolean withColumnExpression)
-
-
-
Constructor Detail
-
WrqBindingItem
protected WrqBindingItem(WrqInfo wrqInfo, org.w3c.dom.Element elem, java.lang.String alias, boolean enforceAggr) throws java.lang.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:
java.lang.Exception
-
WrqBindingItem
protected WrqBindingItem(WrqInfo wrqInfo, org.w3c.dom.Element elem, java.lang.String alias, boolean enforceAggr, WrqBindingItem parentWrqC) throws java.lang.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:
java.lang.Exception
-
WrqBindingItem
protected WrqBindingItem(WrqInfo wrqInfo, java.lang.String wrsAName, java.lang.String aggr, java.lang.String alias, WrqBindingItem parentC, java.lang.String columnExpression)
Used for creating an artificial wrs:A attribute- Parameters:
wrqInfo
-wrsAName
-aggr
-alias
-parentC
-columnExpression
-
-
WrqBindingItem
protected WrqBindingItem(WrqInfo wrqInfo, java.lang.String id, BindingItem bi, java.lang.String alias, boolean enforceAggr)
Used for creating a BindingItem from the info of a BindingSet- Parameters:
wrqInfo
-bi
-alias
-enforceAggr
-
-
-
Method Detail
-
getDefaultAggr
protected static java.lang.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 java.lang.String getAlias()
- Specified by:
getAlias
in interfaceWrsBindingItem
-
getColumnNumber
public int getColumnNumber()
- Specified by:
getColumnNumber
in interfaceWrsBindingItem
-
setColumnNumber
public void setColumnNumber(int columnNumber)
-
isEscapeXML
public java.lang.Boolean isEscapeXML()
- Specified by:
isEscapeXML
in interfaceWrsBindingItem
-
toXML
public void toXML(javax.xml.stream.XMLStreamWriter writer, boolean withColumnExpression) throws javax.xml.stream.XMLStreamException
- Specified by:
toXML
in interfaceWrsBindingItem
- Throws:
javax.xml.stream.XMLStreamException
-
hasWrsAAttributes
public boolean hasWrsAAttributes()
- Specified by:
hasWrsAAttributes
in interfaceWrsBindingItem
-
getWrsAAttributes
public java.util.Collection<WrsBindingItem> getWrsAAttributes()
- Specified by:
getWrsAAttributes
in interfaceWrsBindingItem
-
addWrsAAttribute
public void addWrsAAttribute(WrqBindingItem wrsAttr)
-
getJDBCDataType
public java.lang.Integer getJDBCDataType()
- Specified by:
getJDBCDataType
in interfaceWrsBindingItem
-
getWrsAName
public java.lang.String getWrsAName()
- Specified by:
getWrsAName
in interfaceWrsBindingItem
-
getId
public java.lang.String getId()
- Specified by:
getId
in interfaceWrsBindingItem
-
getAggr
public java.lang.String getAggr()
-
isOrderByDescending
public boolean isOrderByDescending()
-
setOrderByDescending
public void setOrderByDescending(boolean isDescending)
-
getSplitColumnExpression
public java.util.List<java.lang.String> getSplitColumnExpression()
Used to identify column reference parts in a SQL Column expressions to allow for prepending table alias {@see BindingUtils.splitColumnExpression}- Returns:
-
getSplitColumnExpression
public java.util.List<java.lang.String> getSplitColumnExpression(boolean applyVdm)
Used to identify column reference parts in a SQL Column expressions to allow for prepending table alias {@see BindingUtils.splitColumnExpression}- Parameters:
applyVdm
- If false, virtual dimension member caused case-when are ignored here- Returns:
-
getQColumnExpressionWithAggr
public java.lang.String getQColumnExpressionWithAggr() throws BindingNotFoundException
Returns the column expression with table alias and with aggregation applied, if any is set- Returns:
- Throws:
BindingNotFoundException
-
getQColumnExpressionWithAggr
public java.lang.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 java.lang.String getColumnExpressionWithAggr()
Returns the column expression with aggregation applied, if any is set- Returns:
-
getColumnExpressionWithAggr
public java.lang.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 java.lang.String getQColumnExpression() throws BindingNotFoundException
Return the column expression with the table alias- Returns:
- Throws:
BindingNotFoundException
-
getQColumnExpression
public java.lang.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 java.lang.String getColumnExpression()
Return the physical DB column expression including virtual dimension member caused adjustments- Returns:
-
setColumnExpression
public void setColumnExpression(java.lang.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 java.lang.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 java.lang.String getCaption()
- Specified by:
getCaption
in interfaceWrsBindingItem
-
getJDBCColumnScale
public java.lang.String getJDBCColumnScale()
- Specified by:
getJDBCColumnScale
in interfaceWrsBindingItem
-
getBoundVariables
public java.util.List<org.w3c.dom.Element> getBoundVariables()
-
getSkipForTotals
public java.lang.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 java.lang.Object getAttribute(java.lang.String name)
-
setTableAliasOverwrite
public void setTableAliasOverwrite(java.lang.String tableAlias)
-
-