All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sf.jasperreports.engine.query.JRXlsQueryExecuterFactory Maven / Gradle / Ivy

There is a newer version: 6.21.3
Show newest version
/*
 * JasperReports - Free Java Reporting Library.
 * Copyright (C) 2001 - 2011 Jaspersoft Corporation. All rights reserved.
 * http://www.jaspersoft.com
 *
 * Unless you have purchased a commercial license agreement from Jaspersoft,
 * the following license terms apply:
 *
 * This program is part of JasperReports.
 *
 * JasperReports is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * JasperReports is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with JasperReports. If not, see .
 */
package net.sf.jasperreports.engine.query;

import java.util.Map;

import net.sf.jasperreports.engine.JRDataset;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JRPropertiesUtil;
import net.sf.jasperreports.engine.JRValueParameter;
import net.sf.jasperreports.engine.JasperReportsContext;

/**
 * Query executer factory for XLS file type.
 * 

* The factory creates {@link net.sf.jasperreports.engine.query.JRXlsQueryExecuter JRXlsQueryExecuter} * query executers. * * @author Narcis Marcu ([email protected]) * @version $Id: JRXlsQueryExecuterFactory.java 5305 2012-04-26 15:17:33Z teodord $ */ public class JRXlsQueryExecuterFactory extends AbstractQueryExecuterFactory { /** * Built-in parameter holding the value of the jxl.Workbook to be used for obtaining the XLS data. */ public static final String XLS_WORKBOOK = "XLS_WORKBOOK"; /** * Built-in parameter holding the value of the java.io.InputStream to be used for obtaining the XLS data. */ public static final String XLS_INPUT_STREAM = "XLS_INPUT_STREAM"; /** * Built-in parameter holding the value of the java.io.File to be used for obtaining the XLS data. */ public static final String XLS_FILE = "XLS_FILE"; /** * Built-in parameter/property holding the value of the java.lang.String source to be used for obtaining the XLS data. */ public static final String XLS_SOURCE = JRPropertiesUtil.PROPERTY_PREFIX + "xls.source"; /** * Built-in parameter/property holding the value of the columns to be extracted from the XLS source. * When used as report parameter, the value has to be a java.lang.String object containing column names separated by commas. * It can also be used as the prefix for custom dataset properties specifying the names of the XLS columns in the format: * net.sf.jasperreports.xls.column.names.{arbitrary_name}=value1[, value2, ...] */ public static final String XLS_COLUMN_NAMES = JRPropertiesUtil.PROPERTY_PREFIX + "xls.column.names"; /** * Built-in parameter/property holding the value of the column indexs to be extracted from the XLS source. * When used as report parameter, the value has to be a java.lang.String object containing column indexes separated by comma. * It can also be used as the prefix for custom dataset properties specifying the names of the XLS column indexes in the format: * net.sf.jasperreports.xls.column.indexes.{arbitrary_name}=value1[, value2, ...] */ public static final String XLS_COLUMN_INDEXES = JRPropertiesUtil.PROPERTY_PREFIX + "xls.column.indexes"; /** * Built-in parameter holding the value of the columns to be extracted from the XLS source, as a java.lang.String[] object. *

* When this parameter is null or missing, its value defaults to the values provided * by properties prefixed with {@link #XLS_COLUMN_NAMES XLS_COLUMN_NAMES}. */ public static final String XLS_COLUMN_NAMES_ARRAY = "XLS_COLUMN_NAMES_ARRAY"; /** * Built-in parameter holding the value of the column indexes to be extracted from the XLS source, as a java.lang.Integer[] object. *

* When this parameter is null or missing, its value defaults to the values provided * by properties prefixed with {@link #XLS_COLUMN_INDEXES XLS_COLUMN_INDEXES}. */ public static final String XLS_COLUMN_INDEXES_ARRAY = "XLS_COLUMN_INDEXES_ARRAY"; /** * Built-in parameter holding the java.util.Locale value of the locale to be used when parsing the XLS data. */ public static final String XLS_LOCALE = "XLS_LOCALE"; /** * Built-in parameter/property holding the java.lang.String code of the locale to be used when parsing the XLS data. *

* The allowed format is: language[_country[_variant]] */ public static final String XLS_LOCALE_CODE = JRPropertiesUtil.PROPERTY_PREFIX + "xls.locale.code"; /** * Built-in parameter holding the java.util.TimeZone value of the timezone to be used when parsing the XLS data. */ public static final String XLS_TIMEZONE = "XLS_TIMEZONE"; /** * Built-in parameter/property holding the java.lang.String value of the time zone id to be used when parsing the XLS data. */ public static final String XLS_TIMEZONE_ID = JRPropertiesUtil.PROPERTY_PREFIX + "xls.timezone.id"; /** * Built-in parameter holding the value of the java.text.DateFormat used to format date columns from the XLS source. */ public static final String XLS_DATE_FORMAT = "XLS_DATE_FORMAT"; /** * Built-in parameter/property holding the value of the date format pattern to be used when parsing the XLS data. */ public static final String XLS_DATE_PATTERN = JRPropertiesUtil.PROPERTY_PREFIX + "xls.date.pattern"; /** * Built-in parameter holding the value of the java.text.NumberFormat used to format numeric columns from the XLS source. */ public static final String XLS_NUMBER_FORMAT = "XLS_NUMBER_FORMAT"; /** * Built-in parameter/property holding the value of the number format pattern to be used when parsing the XLS data. */ public static final String XLS_NUMBER_PATTERN = JRPropertiesUtil.PROPERTY_PREFIX + "xls.number.pattern"; /** * Built-in parameter/property specifying whether or not the column names should be obtained * from the first row in the XLS source. * As parameter, it should hold a java.lang.Boolean value, while as custom dataset property, it should be true or false. * * If this parameter is set to true, then setting the {@link #XLS_COLUMN_NAMES} or {@link #XLS_COLUMN_NAMES_ARRAY} * would have no effect. */ public static final String XLS_USE_FIRST_ROW_AS_HEADER = "XLS_USE_FIRST_ROW_AS_HEADER"; private final static Object[] XLS_BUILTIN_PARAMETERS = { XLS_WORKBOOK, "jxl.Workbook", XLS_INPUT_STREAM, "java.io.InputStream", XLS_FILE, "java.io.File", XLS_SOURCE, "java.lang.String", XLS_COLUMN_NAMES, "java.lang.String", XLS_COLUMN_INDEXES, "java.lang.String", XLS_COLUMN_NAMES_ARRAY, "java.lang.String[]", XLS_COLUMN_INDEXES_ARRAY, "java.lang.Integer[]", XLS_DATE_FORMAT, "java.text.DateFormat", XLS_DATE_PATTERN, "java.lang.String", XLS_NUMBER_FORMAT, "java.text.NumberFormat", XLS_NUMBER_PATTERN, "java.lang.String", XLS_USE_FIRST_ROW_AS_HEADER, "java.lang.Boolean", XLS_LOCALE_CODE, "java.lang.String", XLS_TIMEZONE_ID, "java.lang.String" }; public Object[] getBuiltinParameters() { return XLS_BUILTIN_PARAMETERS; } public JRQueryExecuter createQueryExecuter( JasperReportsContext jasperReportsContext, JRDataset dataset, Map parameters ) throws JRException { return new JRXlsQueryExecuter(jasperReportsContext, dataset, parameters); } public boolean supportsQueryParameterType(String className) { return true; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy