Class JRCsvQueryExecuterFactory
- java.lang.Object
-
- net.sf.jasperreports.engine.query.AbstractQueryExecuterFactory
-
- net.sf.jasperreports.engine.query.JRCsvQueryExecuterFactory
-
- All Implemented Interfaces:
JRQueryExecuterFactory,QueryExecuterFactory,Designated
public class JRCsvQueryExecuterFactory extends AbstractQueryExecuterFactory implements Designated
Query executer factory for CSV file type. The factory createsJRCsvQueryExecuterquery executers.- Author:
- Narcis Marcu (narcism@users.sourceforge.net)
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringCSV_COLUMN_NAMESBuilt-in parameter/property holding the names of the columns (in a comma-separated list) to be extracted from the CSV source.static java.lang.StringCSV_COLUMN_NAMES_ARRAYBuilt-in parameter holding the value of the columns to be extracted from the CSV source, as ajava.lang.String[]object.static java.lang.StringCSV_DATE_FORMATBuilt-in parameter holding the value of thejava.text.DateFormatused to format date columns from the CSV source.static java.lang.StringCSV_DATE_PATTERNBuilt-in parameter/property holding the value of the date format pattern to be used when parsing the CSV data.static java.lang.StringCSV_ENCODINGBuilt-in parameter/property holding the value of the charset used to encode the CSV stream.static java.lang.StringCSV_FIELD_DELIMITERBuilt-in parameter/property holding the value of the field delimiter from the CSV source.static java.lang.StringCSV_FILEBuilt-in parameter holding the value of thejava.io.Fileto be used for obtaining the CSV data.static java.lang.StringCSV_INPUT_STREAMBuilt-in parameter holding the value of thejava.io.InputStreamto be used for obtaining the CSV data.static java.lang.StringCSV_LOCALEBuilt-in parameter holding thejava.util.Localevalue of the locale to be used when parsing the CSV data.static java.lang.StringCSV_LOCALE_CODEBuilt-in parameter/property holding thejava.lang.Stringcode of the locale to be used when parsing the CSV data.static java.lang.StringCSV_NUMBER_FORMATBuilt-in parameter holding the value of thejava.text.NumberFormatused to format numeric columns from the CSV source.static java.lang.StringCSV_NUMBER_PATTERNBuilt-in parameter/property holding the value of the number format pattern to be used when parsing the CSV data.static java.lang.StringCSV_READERBuilt-in parameter holding the value of thejava.io.Readerto be used for obtaining the CSV data.static java.lang.StringCSV_RECORD_DELIMITERBuild-in parameter/property holding the value of the record delimiter from the CSV sourcestatic java.lang.StringCSV_SOURCEBuilt-in parameter/property holding the value of the source for the CSV file.static java.lang.StringCSV_TIMEZONEBuilt-in parameter holding thejava.util.TimeZonevalue of the timezone to be used when parsing the CSV data.static java.lang.StringCSV_TIMEZONE_IDBuilt-in parameter/property holding thejava.lang.Stringvalue of the time zone id to be used when parsing the CSV data.static java.lang.StringCSV_URLBuilt-in parameter holding the value of thejava.net.URLto be used for obtaining the CSV data.static java.lang.StringCSV_USE_FIRST_ROW_AS_HEADERBuilt-in parameter/property specifying whether or not the column names should be obtained from the first row in the CSV source.static java.lang.StringQUERY_EXECUTER_NAME-
Fields inherited from interface net.sf.jasperreports.engine.query.QueryExecuterFactory
QUERY_EXECUTER_FACTORY_PREFIX
-
-
Constructor Summary
Constructors Constructor Description JRCsvQueryExecuterFactory()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description JRQueryExecutercreateQueryExecuter(JasperReportsContext jasperReportsContext, JRDataset dataset, java.util.Map<java.lang.String,? extends JRValueParameter> parameters)Creates a query executer.JRQueryExecutercreateQueryExecuter(QueryExecutionContext context, JRDataset dataset, java.util.Map<java.lang.String,? extends JRValueParameter> parameters)java.lang.Object[]getBuiltinParameters()Returns the built-in parameters associated with this query type.java.lang.StringgetDesignation()booleansupportsQueryParameterType(java.lang.String className)Decides whether the query executers created by this factory support a query parameter type.-
Methods inherited from class net.sf.jasperreports.engine.query.AbstractQueryExecuterFactory
createQueryExecuter
-
-
-
-
Field Detail
-
QUERY_EXECUTER_NAME
public static final java.lang.String QUERY_EXECUTER_NAME
- See Also:
- Constant Field Values
-
CSV_SOURCE
public static final java.lang.String CSV_SOURCE
Built-in parameter/property holding the value of the source for the CSV file. It can be:- a resource on the classpath
- a file from the filesystem, with an absolute or relative path
- a url
- See Also:
- Constant Field Values
-
CSV_INPUT_STREAM
public static final java.lang.String CSV_INPUT_STREAM
Built-in parameter holding the value of thejava.io.InputStreamto be used for obtaining the CSV data.- See Also:
- Constant Field Values
-
CSV_URL
public static final java.lang.String CSV_URL
Built-in parameter holding the value of thejava.net.URLto be used for obtaining the CSV data.- See Also:
- Constant Field Values
-
CSV_FILE
public static final java.lang.String CSV_FILE
Built-in parameter holding the value of thejava.io.Fileto be used for obtaining the CSV data.- See Also:
- Constant Field Values
-
CSV_READER
public static final java.lang.String CSV_READER
Built-in parameter holding the value of thejava.io.Readerto be used for obtaining the CSV data.- See Also:
- Constant Field Values
-
CSV_ENCODING
public static final java.lang.String CSV_ENCODING
Built-in parameter/property holding the value of the charset used to encode the CSV stream. It is meaningful only in combination withCSV_INPUT_STREAM,CSV_URLorCSV_FILE.- See Also:
- Constant Field Values
-
CSV_COLUMN_NAMES
public static final java.lang.String CSV_COLUMN_NAMES
Built-in parameter/property holding the names of the columns (in a comma-separated list) to be extracted from the CSV source. When used as report parameter, the value has to be ajava.lang.Stringobject containing column names separated by commas. It can also be used as the prefix for custom dataset properties specifying the names of the CSV columns in the format:net.sf.jasperreports.csv.column.names.{arbitrary_name}=value1[, value2, ...]- See Also:
- Constant Field Values
-
CSV_COLUMN_NAMES_ARRAY
public static final java.lang.String CSV_COLUMN_NAMES_ARRAY
Built-in parameter holding the value of the columns to be extracted from the CSV source, as ajava.lang.String[]object. When this parameter is null or missing, its value defaults to the values provided by properties prefixed withCSV_COLUMN_NAMES.- See Also:
- Constant Field Values
-
CSV_LOCALE
public static final java.lang.String CSV_LOCALE
Built-in parameter holding thejava.util.Localevalue of the locale to be used when parsing the CSV data.- See Also:
- Constant Field Values
-
CSV_LOCALE_CODE
public static final java.lang.String CSV_LOCALE_CODE
Built-in parameter/property holding thejava.lang.Stringcode of the locale to be used when parsing the CSV data. The allowed format is: language[_country[_variant]]- See Also:
- Constant Field Values
-
CSV_TIMEZONE
public static final java.lang.String CSV_TIMEZONE
Built-in parameter holding thejava.util.TimeZonevalue of the timezone to be used when parsing the CSV data.- See Also:
- Constant Field Values
-
CSV_TIMEZONE_ID
public static final java.lang.String CSV_TIMEZONE_ID
Built-in parameter/property holding thejava.lang.Stringvalue of the time zone id to be used when parsing the CSV data.- See Also:
- Constant Field Values
-
CSV_DATE_FORMAT
public static final java.lang.String CSV_DATE_FORMAT
Built-in parameter holding the value of thejava.text.DateFormatused to format date columns from the CSV source.- See Also:
- Constant Field Values
-
CSV_DATE_PATTERN
public static final java.lang.String CSV_DATE_PATTERN
Built-in parameter/property holding the value of the date format pattern to be used when parsing the CSV data.- See Also:
- Constant Field Values
-
CSV_FIELD_DELIMITER
public static final java.lang.String CSV_FIELD_DELIMITER
Built-in parameter/property holding the value of the field delimiter from the CSV source.- See Also:
- Constant Field Values
-
CSV_NUMBER_FORMAT
public static final java.lang.String CSV_NUMBER_FORMAT
Built-in parameter holding the value of thejava.text.NumberFormatused to format numeric columns from the CSV source.- See Also:
- Constant Field Values
-
CSV_NUMBER_PATTERN
public static final java.lang.String CSV_NUMBER_PATTERN
Built-in parameter/property holding the value of the number format pattern to be used when parsing the CSV data.- See Also:
- Constant Field Values
-
CSV_RECORD_DELIMITER
public static final java.lang.String CSV_RECORD_DELIMITER
Build-in parameter/property holding the value of the record delimiter from the CSV source- See Also:
- Constant Field Values
-
CSV_USE_FIRST_ROW_AS_HEADER
public static final java.lang.String CSV_USE_FIRST_ROW_AS_HEADER
Built-in parameter/property specifying whether or not the column names should be obtained from the first row in the CSV source. As parameter, it should hold ajava.lang.Booleanvalue, while as custom dataset property, it should be true or false. If this parameter is set to true, then setting theCSV_COLUMN_NAMESorCSV_COLUMN_NAMES_ARRAYwould have no effect.- See Also:
- Constant Field Values
-
-
Method Detail
-
getBuiltinParameters
public java.lang.Object[] getBuiltinParameters()
Description copied from interface:QueryExecuterFactoryReturns the built-in parameters associated with this query type. These parameters will be created as system-defined parameters for each report/dataset having a query of this type. The returned array should contain consecutive pairs of parameter names and parameter classes (e.g.{"Param1", String.class, "Param2", "List.class"}).- Specified by:
getBuiltinParametersin interfaceJRQueryExecuterFactory- Specified by:
getBuiltinParametersin interfaceQueryExecuterFactory- Returns:
- array of built-in parameter names and types associated with this query type
-
createQueryExecuter
public JRQueryExecuter createQueryExecuter(JasperReportsContext jasperReportsContext, JRDataset dataset, java.util.Map<java.lang.String,? extends JRValueParameter> parameters) throws JRException
Description copied from interface:QueryExecuterFactoryCreates a query executer. This method is called at fill time for reports/datasets having a query supported by this factory.- Specified by:
createQueryExecuterin interfaceQueryExecuterFactory- Parameters:
jasperReportsContext- the JasperReportsContextdataset- the dataset containing the query, fields, etcparameters- map of value parameters (instances ofJRValueParameter) indexed by name- Returns:
- a query executer
- Throws:
JRException
-
createQueryExecuter
public JRQueryExecuter createQueryExecuter(QueryExecutionContext context, JRDataset dataset, java.util.Map<java.lang.String,? extends JRValueParameter> parameters) throws JRException
- Specified by:
createQueryExecuterin interfaceQueryExecuterFactory- Throws:
JRException
-
supportsQueryParameterType
public boolean supportsQueryParameterType(java.lang.String className)
Description copied from interface:QueryExecuterFactoryDecides whether the query executers created by this factory support a query parameter type. This check is performed for all $P{..} parameters in the query.- Specified by:
supportsQueryParameterTypein interfaceJRQueryExecuterFactory- Specified by:
supportsQueryParameterTypein interfaceQueryExecuterFactory- Parameters:
className- the value class name of the parameter- Returns:
- whether the parameter value type is supported
-
getDesignation
public java.lang.String getDesignation()
- Specified by:
getDesignationin interfaceDesignated
-
-