Java Code Examples for net.sf.jasperreports.engine.JasperReportsContext#getExtensions()

The following examples show how to use net.sf.jasperreports.engine.JasperReportsContext#getExtensions() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DataAdapterServiceUtil.java    From jasperreports with GNU Lesser General Public License v3.0 6 votes vote down vote up
/**
 *
 */
public DataAdapterService getService(DataAdapter dataAdapter)
{
	JasperReportsContext jasperReportsContext = paramContribContext.getJasperReportsContext();
	
	List<DataAdapterContributorFactory> bundles = jasperReportsContext.getExtensions(
			DataAdapterContributorFactory.class);
	for (Iterator<DataAdapterContributorFactory> it = bundles.iterator(); it.hasNext();)
	{
		DataAdapterContributorFactory factory = it.next();
		DataAdapterService service = factory.getDataAdapterService(paramContribContext, dataAdapter);
		if (service != null)
		{
			return service;
		}
	}

	throw 
		new JRRuntimeException(
			EXCEPTION_MESSAGE_KEY_SERVICE_FACTORY_NOT_REGISTERED,
			new Object[]{dataAdapter.getName()});
}
 
Example 2
Source File: ReportClassFilter.java    From jasperreports with GNU Lesser General Public License v3.0 6 votes vote down vote up
public ReportClassFilter(JasperReportsContext jasperReportsContext)
{
	JRPropertiesUtil properties = JRPropertiesUtil.getInstance(jasperReportsContext);
	filterEnabled = properties.getBooleanProperty(PROPERTY_PREFIX_CLASS_FILTER_ENABLED);
	if (filterEnabled)
	{
		whitelists = new ArrayList<>();
		
		StandardReportClassWhitelist whitelist = new StandardReportClassWhitelist();
		addHardcodedWhitelist(whitelist);
		loadPropertiesWhitelist(properties, whitelist);
		loadFunctionsWhitelist(jasperReportsContext, whitelist);
		whitelists.add(whitelist);
		
		List<ReportClassWhitelist> extensionWhitelists = jasperReportsContext.getExtensions(
				ReportClassWhitelist.class);
		whitelists.addAll(extensionWhitelists);			
	}		
}
 
Example 3
Source File: RequirejsConfigCreator.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected void setModuleMappings(JasperReportsContext jrContext, String contextPath, ObjectNode configPaths)
{
	WebUtil webUtil = WebUtil.getInstance(jrContext);
	List<RequirejsModuleMapping> requirejsMappings = jrContext.getExtensions(RequirejsModuleMapping.class);
	for (RequirejsModuleMapping requirejsMapping : requirejsMappings)
	{
		String modulePath = requirejsMapping.getPath();
		if (requirejsMapping.isClasspathResource())
		{
			modulePath = contextPath + webUtil.getResourcesBasePath() + modulePath;
		}
		configPaths.put(requirejsMapping.getName(), modulePath);
	}
}
 
Example 4
Source File: RequirejsConfigCreator.java    From jasperreports with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected void runContributors(JasperReportsContext jrContext, String contextPath, ObjectNode configRoot)
{
	List<RequirejsConfigContributor> contributors = jrContext.getExtensions(RequirejsConfigContributor.class);
	for (RequirejsConfigContributor contributor : contributors)
	{
		contributor.contribute(context, configRoot);
	}
}
 
Example 5
Source File: LocaleResolverUtil.java    From jasperreports with GNU Lesser General Public License v3.0 4 votes vote down vote up
public LocaleResolverUtil(JasperReportsContext jasperReportsContext)
{
	resolvers = jasperReportsContext.getExtensions(WebLocaleResolver.class);
}