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

net.sf.dynamicreports.report.base.DRDataset Maven / Gradle / Ivy

Go to download

DynamicReports is an open source Java reporting library based on JasperReports. It allows to create dynamic report designs and it doesn't need a visual report designer. You can very quickly create reports and produce documents that can be displayed, printed or exported into many popular formats such as PDF, Excel, Word and others.

There is a newer version: 6.20.1
Show newest version
/**
 * DynamicReports - Free Java reporting library for creating reports dynamically
 *
 * Copyright (C) 2010 - 2016 Ricardo Mariaca
 * http://www.dynamicreports.org
 *
 * This file is part of DynamicReports.
 *
 * DynamicReports 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.
 *
 * DynamicReports 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 DynamicReports. If not, see .
 */

package net.sf.dynamicreports.report.base;

import java.sql.Connection;
import java.util.ArrayList;
import java.util.List;

import net.sf.dynamicreports.report.constant.Constants;
import net.sf.dynamicreports.report.definition.DRIDataset;
import net.sf.dynamicreports.report.definition.expression.DRIExpression;

import org.apache.commons.lang3.Validate;

/**
 * @author Ricardo Mariaca ([email protected])
 */
public class DRDataset implements DRIDataset {
	private static final long serialVersionUID = Constants.SERIAL_VERSION_UID;

	private List> fields;
	private List> variables;
	private List sorts;
	private DRQuery query;
	private DRIExpression connectionExpression;
	private DRIExpression dataSourceExpression;
	private DRIExpression filterExpression;

	public DRDataset() {
		init();
	}

	private void init() {
		this.fields = new ArrayList>();
		this.variables = new ArrayList>();
		this.sorts = new ArrayList();
	}

	@Override
	public List> getFields() {
		return fields;
	}

	public void setFields(List> fields) {
		Validate.notNull(fields, "fields must not be null");
		Validate.noNullElements(fields, "fields must not contains null field");
		this.fields = fields;
	}

	public void addField(DRField field) {
		Validate.notNull(field, "field must not be null");
		this.fields.add(field);
	}

	@Override
	public List> getVariables() {
		return variables;
	}

	public void setVariables(List> variables) {
		Validate.notNull(variables, "variables must not be null");
		Validate.noNullElements(variables, "variables must not contains null variable");
		this.variables = variables;
	}

	public void addVariable(DRVariable variable) {
		Validate.notNull(variable, "variable must not be null");
		this.variables.add(variable);
	}

	@Override
	public List getSorts() {
		return sorts;
	}

	public void setSorts(List sorts) {
		Validate.notNull(sorts, "sorts must not be null");
		Validate.noNullElements(sorts, "sorts must not contains null sort");
		this.sorts = sorts;
	}

	public void addSort(DRSort sort) {
		Validate.notNull(sort, "sort must not be null");
		this.sorts.add(sort);
	}

	@Override
	public DRQuery getQuery() {
		return query;
	}

	public void setQuery(DRQuery query) {
		this.query = query;
	}

	@Override
	public DRIExpression getConnectionExpression() {
		return connectionExpression;
	}

	public void setConnectionExpression(DRIExpression connectionExpression) {
		this.connectionExpression = connectionExpression;
	}

	@Override
	public DRIExpression getDataSourceExpression() {
		return dataSourceExpression;
	}

	public void setDataSourceExpression(DRIExpression dataSourceExpression) {
		this.dataSourceExpression = dataSourceExpression;
	}

	@Override
	public DRIExpression getFilterExpression() {
		return filterExpression;
	}

	public void setFilterExpression(DRIExpression filterExpression) {
		this.filterExpression = filterExpression;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy