public class FieldValueProvider extends SQLValueProvider implements CascadingSource
MAX_RECORDS
Constructor and Description |
---|
FieldValueProvider(DatabaseField values,
DatabaseField descriptions,
int sortType)
Creates a FieldValueProvider with the given DatabaseFields.
|
Modifier and Type | Method and Description |
---|---|
Datasource |
getDatasource()
Returns the data source the query is to be run on
|
DatabaseField |
getDescriptions()
Returns the DatabaseField responsible for fetching the descriptions from.
|
java.lang.String |
getFieldRefName()
Returns the name to be used as the SQL reference name in the WHERE part of the query
used by a cascading prompt referencing this as its parent.
|
protected java.lang.String |
getSQL(java.lang.String where,
boolean join,
boolean distinct)
Returns the query to be used, using the given String as its WHERE condition
|
java.lang.String |
getSQL()
Returns the query which is to be used for fetching the values and optionally descriptions dynamically.
|
int |
getSortType()
Returns the SortField constant specifying how the values are to be sorted.
|
DatabaseField |
getValues()
Returns the DatabaseField responsible for fetching the values from.
|
void |
setDatasource(Datasource datasource)
Sets the datasource to run the query on.
|
void |
setDescriptions(DatabaseField descriptions)
Sets the description DatabaseField.
|
void |
setSortType(int sortType)
Sets the sort type, specifying how the values are to be sorted.
|
void |
setValues(DatabaseField values)
Sets the DatabaseField for fetching the values from.
|
getDefaultValues
getDefaultValues
isDOMParser, parseDOM, parseElement, parseEndElement, parseText
public FieldValueProvider(DatabaseField values, DatabaseField descriptions, int sortType)
values
- DatabaseField to use to fetch the values. Must not be null.descriptions
- DatabaseField to use to fetch the descriptions. May be null. If not, it must be a String field and its Tablesource
must be the same as the values' TableSourcesortType
- The SortField constant to specify how the values are to be sorted.java.lang.IllegalArgumentException
- if values is null, or the table sources of the two fields
are not the same or the table source comes from an SQL querySortField.ASCENDING_ORDER
,
SortField.DESCENDING_ORDER
,
SortField.ORIGINAL_ORDER
protected java.lang.String getSQL(java.lang.String where, boolean join, boolean distinct) throws ReportException, java.sql.SQLException
where
- WHERE condition to use. If no WHERE condition is to be used, use an empty string.join
- if set to true, a full join on all tables of the report will be created, otherwise only a select of the single table of this value will be createddistinct
- if set to true, the query will contain the DISTINCT keywordReportException
- if the database structure does allow a single joined queryjava.sql.SQLException
- on SQL errors during requesting metadatapublic java.lang.String getSQL() throws ReportException, java.sql.SQLException
getSQL
in class SQLValueProvider
ReportException
- if the database structure does allow a single joined queryjava.sql.SQLException
- on SQL errors during requesting metadatapublic int getSortType()
SortField.ASCENDING_ORDER
,
SortField.DESCENDING_ORDER
,
SortField.ORIGINAL_ORDER
public void setSortType(int sortType)
sortType
- SortField constant specifying how to sort the values.SortField.ASCENDING_ORDER
,
SortField.DESCENDING_ORDER
,
SortField.ORIGINAL_ORDER
public DatabaseField getDescriptions()
public void setDescriptions(DatabaseField descriptions)
descriptions
- DatabaseField for the descriptionspublic DatabaseField getValues()
public void setValues(DatabaseField values)
values
- DatabaseField for the valuesjava.lang.IllegalArgumentException
- if values is null or its table source does not match the
description field's table sourcepublic Datasource getDatasource()
getDatasource
in class SQLValueProvider
public void setDatasource(Datasource datasource)
datasource
- data source to run the query on.java.lang.IllegalArgumentException
- if datasource is nullpublic java.lang.String getFieldRefName()
reference name
= prompt value
)".getFieldRefName
in interface CascadingSource
CascadingValueProvider
,
SQLValueProvider
Copyright © 1999-2020 by i-net software GmbH