Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package sk.seges.acris.reporting.server.service;
 
 import java.util.Map;
 
 
 import  com.jaspersoft.jasperserver.api.metadata.jasperreports.service.ReportDataSourceService;

this service serves only for setting of JRParameter.REPORT_DATA_SOURCE, but is necessary for JasperServer
it can be extended if some action with parameters is needed the service is used in CustomJavaBeanDataSourceFactory

Parameters:
<T> type of bean which is used as a row in JasperReport
Author(s):
marta
public class CustomDataSourceService<T> implements ReportDataSourceService {
	public CustomDataSourceService(CustomDataSource<T> customDataSource) {
		super();
		this.init(customDataSource);
	}
	public void init(CustomDataSource<T> source) {
		this. = source;
	}

method is final because parameter REPORT_DATA_SOURCE must be set additional parameters can be set via setExtendedReportParameterValues
	@SuppressWarnings("unchecked")
	public final void setReportParameterValues(Map parameters) {
		try {
catch (Exception ex) {
			throw new JRRuntimeException("Unable to set report parameter values"ex);
		}
	}

if this method is overridden, some action with parameters can be provided, all parameters has to be provided as parameters in jrxml file and also as input controls in jasperserver repository

Parameters:
Map of parameters of report
	protected void setExtendedReportParameterValues(Map<StringObjectparametersthrows Exception {
		return;
	}
	public void closeConnection() {
	// TODO: add connection close support. do not need this...
	}
	public void setCustomDataSource(CustomDataSource<T> customDataSource) {
		this. = customDataSource;
	}
	}
New to GrepCode? Check out our FAQ X