Package de.businesscode.bcdui.binding
Class BindingItem
- java.lang.Object
-
- de.businesscode.bcdui.binding.SimpleBindingItem
-
- de.businesscode.bcdui.binding.BindingItem
-
- Direct Known Subclasses:
BindingItemFromRel
,BindingItemWithMetaData
,VirtualBindingItem
public class BindingItem extends SimpleBindingItem
The BindingItem class represents a mapping from a logical name to a
database column. These classes are contained inside BindingSets and
constructed by the Bindings class from static XML files.- See Also:
Bindings
,BindingSet
-
-
Field Summary
-
Fields inherited from class de.businesscode.bcdui.binding.SimpleBindingItem
BCD_NO_TABLE_ALIAS, columnExpression, pureColumnNamePattern, qColumnExpr, wordPattern
-
-
Constructor Summary
Constructors Constructor Description BindingItem(BindingItem src)
Copy constructor.BindingItem(java.lang.String pName, java.lang.String pColumnExpression, boolean pColumnQuoting, BindingSet pBindingSet)
Constructs a BindingItem.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.lang.String
getAggr()
Default aggregator, when none is given in the Wrqjava.util.Map<java.lang.String,java.lang.Object>
getAttributes()
java.lang.String
getCaption()
Gets value of caption attribute or empty string.java.lang.String
getColumnExpression()
Gets the column expression for a BindingItem.java.util.Map<java.lang.String,java.lang.String>
getCustomAttributesMap()
java.lang.String
getDisplayFormat()
Deprecated.This method should no longer be used.org.w3c.dom.Node
getDisplayFormatAsNode()
Deprecated.Use the methodgetJDBCDataType()
instead.java.lang.Integer
getJDBCColumnDisplaySize()
Retrieves the number of characters for this column.java.lang.Integer
getJDBCColumnScale()
Gets the number of decimal places if this is a numeric column.java.lang.Integer
getJDBCDataType()
The basic type of the database column which can be String or Number.java.lang.String
getJDBCDataTypeName()
Gets the name of the JDBC data type.java.lang.Integer
getJDBCNullable()
java.lang.Boolean
getJDBCSigned()
Indicates whether the column allows negative numbers or not.java.lang.String
getReferences()
Gets the References element as serialized XML element.org.w3c.dom.Node
getReferencesAsNode()
Retrieves the content of the References element as a w3c.Node or NULL if there is no References element.boolean
isDefinedJDBCDataType()
java.lang.Boolean
isEscapeXML()
Returns true if the content will be stored as an escaped XML string, otherwise it is plain XMLboolean
isKey()
Tests if the BindingItem is marked as a key column in the BindingSet.boolean
isNumeric()
java.lang.Boolean
isReadOnly()
gets if the BindingItem is read onlyvoid
setAggr(java.lang.String aggr)
void
setCaption(java.lang.String caption)
Sets value of caption attribute.void
setDisplayFormat(java.lang.String displayFormat)
void
setEscapeXML(java.lang.Boolean isEscapeXML)
If true, treats content as a string of escaped XML.void
setJDBCColumnDisplaySize(java.lang.Integer jdbcColumnDisplaySize)
void
setJDBCColumnScale(java.lang.Integer jdbcColumnScale)
void
setJDBCDataType(java.lang.Integer jdbcDataType)
The basic type of the database column which can be String or Number.void
setJDBCDataTypeName(java.lang.String jdbcDataTypeName)
void
setJDBCNullable(java.lang.Integer jdbcNullable)
Determines if the column can take a NULL value or not.void
setJDBCSigned(java.lang.Boolean jdbcSigned)
void
setKey(boolean isKey)
void
setReadOnly(java.lang.Boolean isReadOnly)
sets if the BindingItem is read onlyvoid
setReferences(java.lang.String references)
java.lang.String
toString()
A useful method for debugging.void
toXML(javax.xml.stream.XMLStreamWriter writer, boolean withColumnExpression)
Prints an XML representation of the BindingItem.-
Methods inherited from class de.businesscode.bcdui.binding.SimpleBindingItem
getBindingSet, getId, getQColumnExpression, isColumnQuoting, setBindingSet, setColumnExpression, setId
-
-
-
-
Constructor Detail
-
BindingItem
public BindingItem(BindingItem src)
Copy constructor.
-
BindingItem
public BindingItem(java.lang.String pName, java.lang.String pColumnExpression, boolean pColumnQuoting, BindingSet pBindingSet)
Constructs a BindingItem.- Parameters:
pName
- The name of the BindingItem.pBindingSet
- The BindingSet.
in the SQL code generated from the BindingItem.pColumnExpression
- A list of database columns for the BindingItems.
Since multi-bindings are no longer supported this list should contain exactly one item.pColumnQuoting
- True, if the columnExpression should be in quotes or not.
For some reserved keyword of the database it is necessary to place the
column name in quotes.
-
-
Method Detail
-
getCustomAttributesMap
public java.util.Map<java.lang.String,java.lang.String> getCustomAttributesMap()
- Returns:
- the customAttributesMap
-
toString
public java.lang.String toString()
A useful method for debugging.- Overrides:
toString
in classjava.lang.Object
- Returns:
- A list of column expressions.
-
getColumnExpression
public java.lang.String getColumnExpression()
Gets the column expression for a BindingItem. In many cases this is just a database column name, but it can be a simple SQL expression as well.- Overrides:
getColumnExpression
in classSimpleBindingItem
- Returns:
- The SQL code - often just a column name - assigned to the BindingItem.
-
getJDBCDataType
public java.lang.Integer getJDBCDataType()
The basic type of the database column which can be String or Number.- Returns:
- The abstract column type of the database column.
-
isDefinedJDBCDataType
public boolean isDefinedJDBCDataType()
-
isNumeric
public boolean isNumeric()
-
setJDBCDataType
public void setJDBCDataType(java.lang.Integer jdbcDataType)
The basic type of the database column which can be String or Number.
-
isKey
public boolean isKey()
Tests if the BindingItem is marked as a key column in the BindingSet.- Returns:
- True if this BindingItem is a key item.
-
setKey
public void setKey(boolean isKey)
-
setJDBCDataTypeName
public void setJDBCDataTypeName(java.lang.String jdbcDataTypeName) throws java.lang.IllegalArgumentException, java.lang.SecurityException, java.lang.IllegalAccessException, java.lang.NoSuchFieldException
- Throws:
java.lang.IllegalArgumentException
java.lang.SecurityException
java.lang.IllegalAccessException
java.lang.NoSuchFieldException
-
getJDBCDataTypeName
public java.lang.String getJDBCDataTypeName()
Gets the name of the JDBC data type.- Returns:
- A string corresponding to the constant name of the JDBC data type. The names are listed in java.sql.Types.
- See Also:
Types
-
setJDBCColumnDisplaySize
public void setJDBCColumnDisplaySize(java.lang.Integer jdbcColumnDisplaySize)
-
getJDBCColumnDisplaySize
public java.lang.Integer getJDBCColumnDisplaySize()
Retrieves the number of characters for this column.- Returns:
- The size of the column as number of characters. It can be NULL if this value is not set in the BindingSet.
- See Also:
ResultSetMetaData.getColumnDisplaySize(int)
-
setJDBCColumnScale
public void setJDBCColumnScale(java.lang.Integer jdbcColumnScale)
-
getJDBCColumnScale
public java.lang.Integer getJDBCColumnScale()
Gets the number of decimal places if this is a numeric column. An integer number has 0 decimal places.- Returns:
- The number of positions after the decimal point. This can be NULL if the value has not been specified.
- See Also:
ResultSetMetaData.getScale(int)
-
setJDBCSigned
public void setJDBCSigned(java.lang.Boolean jdbcSigned)
-
getJDBCSigned
public java.lang.Boolean getJDBCSigned()
Indicates whether the column allows negative numbers or not.- Returns:
- True if negative numbers are allowed. The result can be NULL if this property has not been set.
- See Also:
ResultSetMetaData.isSigned(int)
-
getAggr
public java.lang.String getAggr()
Default aggregator, when none is given in the Wrq- Returns:
-
setAggr
public void setAggr(java.lang.String aggr)
-
setJDBCNullable
public void setJDBCNullable(java.lang.Integer jdbcNullable)
Determines if the column can take a NULL value or not.- See Also:
ResultSetMetaData.isNullable(int)
-
getJDBCNullable
public java.lang.Integer getJDBCNullable()
-
getReferencesAsNode
public org.w3c.dom.Node getReferencesAsNode() throws javax.xml.parsers.ParserConfigurationException, org.xml.sax.SAXException, java.io.IOException
Retrieves the content of the References element as a w3c.Node or NULL if there is no References element.- Returns:
- The References element or NULL if there is no such element.
- Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException
-
getReferences
public java.lang.String getReferences()
Gets the References element as serialized XML element.- Returns:
- The References element in a string form.
-
setReferences
public void setReferences(java.lang.String references)
-
getDisplayFormat
@Deprecated public java.lang.String getDisplayFormat()
Deprecated.This method should no longer be used. Instead the methodgetJDBCDataType()
can be called.Gets the display format of the column as XML Schema data type.- Returns:
- The XML schema data type of the column.
-
getDisplayFormatAsNode
@Deprecated public org.w3c.dom.Node getDisplayFormatAsNode() throws org.xml.sax.SAXException, java.io.IOException, javax.xml.parsers.ParserConfigurationException
Deprecated.Use the methodgetJDBCDataType()
instead.Gets the display format as an XML element.- Returns:
- The XML element of the DisplayFormat node.
- Throws:
org.xml.sax.SAXException
java.io.IOException
javax.xml.parsers.ParserConfigurationException
-
setDisplayFormat
public void setDisplayFormat(java.lang.String displayFormat)
-
getCaption
public java.lang.String getCaption()
Gets value of caption attribute or empty string.- Returns:
- The database column caption.
- See Also:
ResultSetMetaData.getColumnLabel(int)
-
setCaption
public void setCaption(java.lang.String caption)
Sets value of caption attribute.- Parameters:
caption
- The new caption of the column.
-
isReadOnly
public java.lang.Boolean isReadOnly()
gets if the BindingItem is read only
-
setReadOnly
public void setReadOnly(java.lang.Boolean isReadOnly)
sets if the BindingItem is read only- Parameters:
isReadOnly
-
-
isEscapeXML
public java.lang.Boolean isEscapeXML()
Returns true if the content will be stored as an escaped XML string, otherwise it is plain XML
-
setEscapeXML
public void setEscapeXML(java.lang.Boolean isEscapeXML)
If true, treats content as a string of escaped XML. Otherwise it is stored as XML type and returned as inline XML
-
toXML
public void toXML(javax.xml.stream.XMLStreamWriter writer, boolean withColumnExpression) throws javax.xml.stream.XMLStreamException
Prints an XML representation of the BindingItem.- Overrides:
toXML
in classSimpleBindingItem
- Parameters:
writer
- The writer instance to print the data to.- Throws:
javax.xml.stream.XMLStreamException
-
getAttributes
public java.util.Map<java.lang.String,java.lang.Object> getAttributes()
-
-