@Override public List<ParameterContributor> getContributors(ParameterContributorContext context) throws JRException { List<ParameterContributor> contributors = new ArrayList<ParameterContributor>(); String dataAdapterUri = JRPropertiesUtil.getInstance(context.getJasperReportsContext()).getProperty(context.getDataset(), PROPERTY_DATA_ADAPTER_LOCATION); if (dataAdapterUri != null) { DataAdapterResource dataAdapterResource = RepositoryUtil.getInstance(context.getJasperReportsContext()).getResourceFromLocation(dataAdapterUri, DataAdapterResource.class); ParameterContributor dataAdapterService = DataAdapterServiceUtil.getInstance(context).getService(dataAdapterResource.getDataAdapter()); return Collections.singletonList(dataAdapterService); } return contributors; }
/** * */ private List<ParameterContributor> getParameterContributors(ParameterContributorContext context) throws JRException { List<ParameterContributor> allContributors = null; List<?> factories = getJasperReportsContext().getExtensions(ParameterContributorFactory.class); if (factories != null && factories.size() > 0) { allContributors = new ArrayList<ParameterContributor>(); for (Iterator<?> it = factories.iterator(); it.hasNext();) { ParameterContributorFactory factory = (ParameterContributorFactory)it.next(); List<ParameterContributor> contributors = factory.getContributors(context); if (contributors != null) { allContributors.addAll(contributors); } } } return allContributors; }
/** * */ public void contributeParameters(Map<String,Object> parameterValues) throws JRException { parameterContributors = getParameterContributors(new ParameterContributorContext(getJasperReportsContext(), this, parameterValues)); if (parameterContributors != null) { for(ParameterContributor contributor : parameterContributors) { contributor.contributeParameters(parameterValues); } } }
/** * */ public void disposeParameterContributors() { if (parameterContributors != null) { for(ParameterContributor contributor : parameterContributors) { contributor.dispose(); } } }
@Override public List<ParameterContributor> getContributors(ParameterContributorContext context) throws JRException { return Collections.<ParameterContributor>singletonList(new HeaderToolbarParameterContributor(context)); }
@Override public List<ParameterContributor> getContributors(ParameterContributorContext context) throws JRException { return Collections.<ParameterContributor>singletonList(new SortParameterContributor(context)); }