Class CascadingValueProvider
- java.lang.Object
-
- com.inet.report.SQLValueProvider
-
- com.inet.report.FieldValueProvider
-
- com.inet.report.CascadingValueProvider
-
- All Implemented Interfaces:
CascadingSource
,DynamicValueProvider
,HasCascadingParent
,NodeParser
,java.io.Serializable
public class CascadingValueProvider extends FieldValueProvider implements HasCascadingParent
Creates a CascadingValueProvider which provides default values for a prompt based on a value of a parent prompt field.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:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class com.inet.report.SQLValueProvider
MAX_RECORDS
-
-
Constructor Summary
Constructors Constructor Description 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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description PromptField
getParent()
Returns the set parent prompt fieldCascadingSource
getParentSource()
Returns the parent source which provides the reference name for the parent prompt when referencing it in the generated SQL query.java.lang.String
getSQL()
Returns the query which is to be used for fetching the values and optionally descriptions dynamically.NodeParser
parseElement(com.inet.report.parser.XMLTag group, java.lang.String tag, org.xml.sax.Attributes atts, java.util.Map<java.lang.String,java.lang.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 Detail
-
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:
java.lang.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:
SortField.ORIGINAL_ORDER
,SortField.ASCENDING_ORDER
,SortField.DESCENDING_ORDER
,CascadingSource
,FieldValueProvider
-
-
Method Detail
-
getParent
public PromptField getParent()
Returns the set parent prompt field- Specified by:
getParent
in interfaceHasCascadingParent
- Returns:
- Parent prompt field for this cascading provider.
- Since:
- 7.7
-
setParent
public void setParent(PromptField parent)
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:
java.lang.IllegalArgumentException
- if the parent prompt field is null or does not have a FieldValueProvider,- Since:
- 7.7
-
getSQL
public java.lang.String 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
public 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.- Parameters:
parentSource
- parent source which provides the reference name of the parent to use in the query, may not be null- Throws:
java.lang.IllegalArgumentException
- if the parent source given is null- Since:
- 7.7
-
getParentSource
public CascadingSource 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, java.lang.String tag, org.xml.sax.Attributes atts, java.util.Map<java.lang.String,java.lang.Object> parserMap) throws FatalParserException
FOR 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.
-
-