Class CascadingValueProvider
- All Implemented Interfaces:
CascadingSource
,DynamicValueProvider
,HasCascadingParent
,NodeParser
,Serializable
The parent prompt field itself must have a FieldValueProvider so that the possible default values can be filtered with a "WHERE" condition in the query.
For example, a PromptField with a FieldValueProvider pointing to a database field representing countries could be set as a parent for a CascadingValueProvider pointing to a database field representing cities. When the default values are fetched, the value for the country is placed in the "WHERE" condition, thereby only providing the cities in the given country.
- Since:
- 7.7
- See Also:
-
Field Summary
Fields inherited from class com.inet.report.SQLValueProvider
MAX_RECORDS
-
Constructor Summary
ConstructorDescriptionCascadingValueProvider
(PromptField parent, CascadingSource parentSource, DatabaseField values, DatabaseField descriptions, int sortType) Initializes a CascadingValueProvider with the given parent, value field and (optionally) description field, as well as the desired sort type. -
Method Summary
Modifier and TypeMethodDescriptionReturns the set parent prompt fieldReturns the parent source which provides the reference name for the parent prompt when referencing it in the generated SQL query.getSQL()
Returns the query which is to be used for fetching the values and optionally descriptions dynamically.parseElement
(com.inet.report.parser.XMLTag group, String tag, Attributes atts, Map<String, Object> parserMap) FOR INTERNAL USE ONLY FOR INTERNAL USE ONLY Internal method for reading report XMLvoid
setParent
(PromptField parent) Sets the parent prompt field which is to be used for filtering the default values.void
setParentSource
(CascadingSource parentSource) Sets the parent source for this cascading prompt that will provide the reference name of the parent to use in the generated SQL query.Methods inherited from class com.inet.report.FieldValueProvider
getDatasource, getDescriptions, getFieldRefName, getSortType, getSQL, getValues, setDatasource, setDescriptions, setSortType, setValues
Methods inherited from class com.inet.report.SQLValueProvider
getDefaultValues, isDOMParser, parseDOM, parseEndElement, parseText
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.inet.report.DynamicValueProvider
getDefaultValues
-
Constructor Details
-
CascadingValueProvider
public CascadingValueProvider(PromptField parent, CascadingSource parentSource, DatabaseField values, DatabaseField descriptions, int sortType) Initializes a CascadingValueProvider with the given parent, value field and (optionally) description field, as well as the desired sort type.- Parameters:
parent
- Parent prompt field, may not be nullparentSource
- Provider of the SQL reference name for the parentvalues
- Default values' value fielddescriptions
- Default values' descriptions fieldsortType
- Desired sort type- Throws:
IllegalArgumentException
- if the parent prompt field is null or does not have a FieldValueProvider, or if the values field is null or if the sort type is invalid- Since:
- 7.7
- See Also:
-
-
Method Details
-
getParent
Returns the set parent prompt field- Specified by:
getParent
in interfaceHasCascadingParent
- Returns:
- Parent prompt field for this cascading provider.
- Since:
- 7.7
-
setParent
Sets the parent prompt field which is to be used for filtering the default values.- Specified by:
setParent
in interfaceHasCascadingParent
- Parameters:
parent
- Parent prompt field, may not be null and must have a FieldValueProvider- Throws:
IllegalArgumentException
- if the parent prompt field is null or does not have a FieldValueProvider,- Since:
- 7.7
-
getSQL
Returns the query which is to be used for fetching the values and optionally descriptions dynamically.- Overrides:
getSQL
in classFieldValueProvider
- Returns:
- query to be used
- Since:
- 7.7
-
setParentSource
Sets the parent source for this cascading prompt that will provide the reference name of the parent to use in the generated SQL query.- Parameters:
parentSource
- parent source which provides the reference name of the parent to use in the query, may not be null- Throws:
IllegalArgumentException
- if the parent source given is null- Since:
- 7.7
-
getParentSource
Returns the parent source which provides the reference name for the parent prompt when referencing it in the generated SQL query.- Returns:
- parent source
- Since:
- 7.7
-
parseElement
public NodeParser parseElement(com.inet.report.parser.XMLTag group, String tag, Attributes atts, Map<String, Object> parserMap) throws FatalParserExceptionFOR INTERNAL USE ONLY FOR INTERNAL USE ONLY Internal method for reading report XMLParses an XML node with the given information, and returns either a sub-element which was created as a result, or null if no sub-element was created, i.e. the information was applied to the ReportComponent itself. Note that the parsing is highly tolerant, i.e. exceptions are intercepted and suppressed if at all possible.
- Specified by:
parseElement
in interfaceNodeParser
- Overrides:
parseElement
in classFieldValueProvider
- Parameters:
group
- XMLTag of the current node to be parsed, or null if there is no such current group. An XMLTag is a group of nodes bundled together, usually it is a Properties node such as CommonProperties, BorderProperties, etc.tag
- The XMLTag to be parsedatts
- The set of attributes in the current XMLTagparserMap
- The map of current Parser.- Returns:
- The NodeParser sub-element if one needed to be created, or null if none was created.
- Throws:
FatalParserException
- if an exception occurs which causes the report to not be able to be read: causes the abortion of the reading of the report.
-