Package com.inet.report
Class DatabaseField
- java.lang.Object
-
- com.inet.report.Field
-
- com.inet.report.DatabaseField
-
- All Implemented Interfaces:
NodeParser,com.inet.report.ReferencedObject,java.io.Serializable
public class DatabaseField extends Field
This class represents a database field.
ADatabaseFieldholds the information needed to use a field from a database table.
When a field will be evaluated the data of the field are fetched for each record in the table. Therefore the full name of the field in the database table is needed, i.e. "People.Phonenumber". Set it when adding the field to the table source with the methodTableSource.addColumn(String, int)in classTableSourceor with methodsetName(String). The short name is an alias for the full name, i.e. Phonenumber.
Adding and removing of aDatabaseFieldis handled by classTableSource. You can use the following methods to add a database field to an existing report:
engine.getDatabaseTables().getDataSource(string).getTableSource(int or string).addColumn(String, int).
Getting of aDatabaseFieldis handled by classFields. You can use the following method to get a database field of an existing report:
engine.getFields().getDatabaseField(int or string).
To print the fetched data in the report you have to fill it into aFieldElementorFieldPart.
This class is part of the RDC.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class com.inet.report.Field
Field.FieldAttributeTag
-
-
Field Summary
-
Fields inherited from class com.inet.report.Field
BINARY, BOOLEAN, CURRENCY, CURSOR, DATABASE_FIELD, DATE, DATETIME, FORMULA_FIELD, GROUP_NAME_FIELD, NUMBER, PARAMETER_FIELD, SORT_FIELD, SPECIAL_FIELD, SQL_FIELD, STRING, SUMMARY_FIELD, TIME, UNKNOWN
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.StringgetColumnLabel()Returns the label of thisDatabaseField.java.lang.StringgetShortName()Returns the short name of a database field.
This is the name of the database-column without leading table-name, i.e.TableSourcegetTableSource()Returns the table source this database field is based on, will never returnnull.booleanhasColumnLabel()Returns whether a column label was set or not.voidrename(java.lang.String newName)FOR INTERNAL USE ONLYprotected voidsaveFieldXML2(java.io.PrintWriter pw, int depth)FOR INTERNAL USE ONLYvoidsetColumnLabel(java.lang.String columnLabel)Specifies an alias for table columns.voidsetName(java.lang.String fullname)Specifies the name of theDatabaseField.
The name have to start with the name of the table separated with a dot, i.e.java.lang.StringtoString()-
Methods inherited from class com.inet.report.Field
addReferenceHolder, checkNameExists, duplicate, equals, extractReference, getField, getGroup, getName, getPlaceholderName, getRealReferenceCount, getReferenceHolderCount, getReferenceHolders, getRefName, getType, getValueType, indexOf, isDOMParser, isUsed, paramString, parseDOM, parseElement, parseEndElement, parseText, removeReferenceHolder, setField, setGroup, setValueType, trimAwayBrackets
-
-
-
-
Method Detail
-
setName
public void setName(java.lang.String fullname) throws ReportExceptionSpecifies the name of theDatabaseField.
The name have to start with the name of the table separated with a dot, i.e. table.column.
The short name of this field is set to the name of the column. The value type of the database field will be read from the database.- Specified by:
setNamein classField- Parameters:
fullname- The qualified column name for this database field.- Throws:
ReportException- If the alias or table name was missing.java.lang.IllegalArgumentException- If the database field name was empty- Since:
- 1.0
-
setColumnLabel
public void setColumnLabel(java.lang.String columnLabel)
Specifies an alias for table columns. The label is an additional information. It can be used to explain abstract column names. This label will be used from i-net Designer for example. It don't influence the SQL generation.- Parameters:
columnLabel- Label of the database field- Since:
- 6.0
- See Also:
getColumnLabel(),hasColumnLabel()
-
getColumnLabel
public java.lang.String getColumnLabel()
Returns the label of thisDatabaseField. The label is an additional information only. It can be used to explain abstract column names. This label will be used from i-net Designer for example.- Returns:
- Label of the database field as String.
- Since:
- 6.0
- See Also:
getColumnLabel(),hasColumnLabel()
-
hasColumnLabel
public boolean hasColumnLabel()
Returns whether a column label was set or not.- Returns:
trueif a column label was set,falseotherwise.- Since:
- 6.0
- See Also:
setColumnLabel(String),getColumnLabel()
-
getShortName
public java.lang.String getShortName()
Returns the short name of a database field.
This is the name of the database-column without leading table-name, i.e. the name of the database field is 'Customers.Customer ID', the short name should be 'Customer ID'.- Returns:
- The short name of the database field as String.
- Since:
- 1.0
-
rename
public void rename(java.lang.String newName) throws ReportExceptionFOR INTERNAL USE ONLY- Overrides:
renamein classField- Throws:
ReportException
-
saveFieldXML2
protected void saveFieldXML2(java.io.PrintWriter pw, int depth)FOR INTERNAL USE ONLY- Specified by:
saveFieldXML2in classField- Parameters:
pw- the print writerdepth- the current depth
-
getTableSource
public TableSource getTableSource()
Returns the table source this database field is based on, will never returnnull.- Returns:
- TableSource this database field is based on, never
null - Since:
- 7.0
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-