@Override public ExtensionsRegistry createRegistry(String registryId, JRPropertiesMap properties) { List<PropertySuffix> themeProperties = JRPropertiesUtil.getProperties(properties, XML_CHART_THEME_PROPERTY_PREFIX); Map<String, ChartTheme> themes = new HashMap<String, ChartTheme>(); for (Iterator<PropertySuffix> it = themeProperties.iterator(); it.hasNext();) { PropertySuffix themeProp = it.next(); String themeName = themeProp.getSuffix(); String themeLocation = themeProp.getValue(); XmlChartTheme theme = new XmlChartTheme(themeLocation); themes.put(themeName, theme); } ChartThemeMapBundle bundle = new ChartThemeMapBundle(); bundle.setThemes(themes); return new ChartThemeBundlesExtensionsRegistry(bundle); }
@Override public ExtensionsRegistry createRegistry(String registryId, JRPropertiesMap properties) { List<PropertySuffix> jacksonMappingProperties = JRPropertiesUtil.getProperties(properties, JACKSON_MAPPING_PROPERTY_PREFIX); List<JacksonMapping> jacksonMappings = new ArrayList<JacksonMapping>(); for (Iterator<PropertySuffix> it = jacksonMappingProperties.iterator(); it.hasNext();) { PropertySuffix jacksonMappingProp = it.next(); jacksonMappings.add( new JacksonMapping( jacksonMappingProp.getSuffix(), jacksonMappingProp.getValue() ) ); } return new ListExtensionRegistry<JacksonMapping>(JacksonMapping.class, jacksonMappings); }
protected void setPaths(String registryId, JRPropertiesMap properties, RequirejsTemplateConfigContributor templateContributor) { String pathPropPrefix = EXTENSION_PROPERTY_PATH_PREFIX + registryId + "."; List<PropertySuffix> pathProps = JRPropertiesUtil.getProperties(properties, pathPropPrefix); for (PropertySuffix pathProp : pathProps) { String suffix = pathProp.getSuffix(); String path = pathProp.getValue(); if (log.isDebugEnabled()) { log.debug("setting path " + suffix + " to " + path); } templateContributor.addPath(suffix, path); } }
protected void setResources(String registryId, JRPropertiesMap properties, RequirejsTemplateConfigContributor templateContributor) { String pathPropPrefix = EXTENSION_PROPERTY_RESOURCE_PREFIX + registryId + "."; List<PropertySuffix> pathProps = JRPropertiesUtil.getProperties(properties, pathPropPrefix); for (PropertySuffix pathProp : pathProps) { String suffix = pathProp.getSuffix(); String path = pathProp.getValue(); if (log.isDebugEnabled()) { log.debug("setting resource " + suffix + " to " + path); } templateContributor.addResourcePath(suffix, path); } }
@Override public ExtensionsRegistry createRegistry(String registryId, JRPropertiesMap properties) { List<PropertySuffix> requirejsModuleProperties = JRPropertiesUtil.getProperties(properties, REQUIREJS_MAPPING_PROPERTY_PREFIX); List<RequirejsModuleMapping> requirejsModules = new ArrayList<RequirejsModuleMapping>(); for (Iterator<PropertySuffix> it = requirejsModuleProperties.iterator(); it.hasNext();) { PropertySuffix requirejsModuleProp = it.next(); String suffix = requirejsModuleProp.getSuffix(); boolean isClasspathResource = !suffix.endsWith(URL_SUFFIX); requirejsModules.add( new RequirejsModuleMapping( isClasspathResource ? suffix : suffix.substring(0, suffix.indexOf(URL_SUFFIX)), requirejsModuleProp.getValue(), isClasspathResource ) ); } return new ListExtensionRegistry<RequirejsModuleMapping>(RequirejsModuleMapping.class, requirejsModules); }
@Override public ExtensionsRegistry createRegistry(String registryId, JRPropertiesMap properties) { List<PropertySuffix> fontFamiliesProperties = JRPropertiesUtil.getProperties(properties, SIMPLE_FONT_FAMILIES_PROPERTY_PREFIX); List<String> fontFamiliesLocations = new ArrayList<String>(); for (Iterator<PropertySuffix> it = fontFamiliesProperties.iterator(); it.hasNext();) { PropertySuffix fontFamiliesProp = it.next(); //String fontFamiliesName = fontFamiliesProp.getSuffix(); String fontFamiliesLocation = fontFamiliesProp.getValue(); //fontFamiliesLocations.addAll(SimpleFontExtensionHelper.getInstance().loadFontFamilies(fontFamiliesLocation)); fontFamiliesLocations.add(fontFamiliesLocation); } return new FontExtensionsRegistry(fontFamiliesLocations); }
private Map<String, String> extractXmlNamespacesFromProperties() throws JRException { Map<String, String> namespaces = new HashMap<String, String>(); String xmlnsPrefix = JaxenXPathQueryExecuterFactory.XML_NAMESPACE_PREFIX; List<PropertySuffix> nsProperties = JRPropertiesUtil.getProperties(dataset, xmlnsPrefix); for (int i=0; i < nsProperties.size(); ++i) { PropertySuffix prop = nsProperties.get(i); String nsPrefix = prop.getKey().substring(xmlnsPrefix.length()); if (nsPrefix.length() > 0) { namespaces.put(nsPrefix, prop.getValue()); } } return namespaces.size()>0 ? namespaces : null; }
private Map<String, String> extractXmlNamespacesFromProperties() throws JRException { Map<String, String> namespaces = new HashMap<String, String>(); String xmlnsPrefix = XalanXPathQueryExecuterFactory.XML_NAMESPACE_PREFIX; List<PropertySuffix> nsProperties = JRPropertiesUtil.getProperties(dataset, xmlnsPrefix); for (int i=0; i < nsProperties.size(); ++i) { PropertySuffix prop = nsProperties.get(i); String nsPrefix = prop.getKey().substring(xmlnsPrefix.length()); if (nsPrefix.length() > 0) { namespaces.put(nsPrefix, prop.getValue()); } } return namespaces.size()>0 ? namespaces : null; }
private void initExcludeProperties() { JasperReportsContext context = jasperReportsContext == null ? DefaultJasperReportsContext.getInstance() : jasperReportsContext; List<PropertySuffix> excludeProperties = JRPropertiesUtil.getInstance(context).getProperties( PREFIX_EXCLUDE_PROPERTIES); excludePropertiesPattern = new ArrayList<Pattern>(excludeProperties.size()); for (PropertySuffix propertySuffix : excludeProperties) { String regex = propertySuffix.getValue(); Pattern pattern = Pattern.compile(regex); excludePropertiesPattern.add(pattern); } excludeUuids = JRPropertiesUtil.getInstance(context).getBooleanProperty(PROPERTY_EXCLUDE_UUIDS); }
protected void initGlyphRenderer() { glyphRendererBlocks = new HashSet<Character.UnicodeBlock>(); List<PropertySuffix> props = propertiesUtil.getAllProperties(getCurrentJasperPrint(), PdfReportConfiguration.PROPERTY_PREFIX_GLYPH_RENDERER_BLOCKS); for (PropertySuffix prop : props) { String blocks = prop.getValue(); for (String blockToken : blocks.split(",")) { UnicodeBlock block = resolveUnicodeBlock(blockToken); if (block != null) { if (log.isDebugEnabled()) { log.debug("glyph renderer block " + block); } glyphRendererBlocks.add(block); } } } }
public PropertySuffix[] getDefinedNames(JRPrintElement element) { if (element.hasProperties() && element.getPropertiesMap().containsProperty(PROPERTY_DEFINED_NAMES_PREFIX) ) { // we make this test to avoid reaching the global default value of the property directly // and thus skipping the report level one, if present List<PropertySuffix> propertySuffixes = propertiesUtil.getProperties(PROPERTY_DEFINED_NAMES_PREFIX); if (propertySuffixes != null && !propertySuffixes.isEmpty()) { return propertySuffixes.toArray(new PropertySuffix[propertySuffixes.size()]); } } return null; }
protected void configureDefinedNames(PropertySuffix propertySuffix) { if (propertySuffix != null) { String name = propertySuffix.getSuffix(); String value = propertySuffix.getValue(); if (name != null && name.trim().length() > 0 && value != null && value.length() > 0) { String[] valueScope = value.split(DEFAULT_DEFINED_NAME_SCOPE_SEPARATOR); if (valueScope[0] != null && valueScope[0].length() > 0) { String scope = valueScope.length > 1 ? valueScope[1] : DEFAULT_DEFINED_NAME_SCOPE; NameScope nameScope = new NameScope(name, scope); if (valueScope[0].startsWith("=")) { definedNamesMap.put(nameScope, valueScope[0].substring(1)); } else { definedNamesMap.put(nameScope, valueScope[0]); } } } } }
/** * */ private void addFunctionClasses(List<String> classNames, JRPropertiesMap properties, String propertyPrefix) { List<PropertySuffix> functionClassProperties = JRPropertiesUtil.getProperties(properties, propertyPrefix); for (Iterator<PropertySuffix> it = functionClassProperties.iterator(); it.hasNext();) { PropertySuffix functionsClassesProp = it.next(); // We assume this property value is a comma-separated class names list like: a.b.c.ClassA, a.b.d.ClassB String[] classes = functionsClassesProp.getValue().split(","); for (String className : classes) { className = className.trim(); if (className.length() > 0) { classNames.add( className); } } } }
@Override public String[] getStringArrayParameter(net.sf.jasperreports.engine.JRExporterParameter parameter, String propertyPrefix) { String[] values = null; if (parameters.containsKey(parameter)) { values = (String[])parameters.get(parameter); } else { List<PropertySuffix> properties = JRPropertiesUtil.getProperties(jasperPrint.getPropertiesMap(), propertyPrefix); if (properties != null && !properties.isEmpty()) { values = new String[properties.size()]; for(int i = 0; i < values.length; i++) { values[i] = properties.get(i).getValue(); } } } return values; }
@Override public String[] getStringArrayParameter(net.sf.jasperreports.engine.JRExporterParameter parameter, String propertyPrefix) { String[] values = null; JRPropertiesMap hintsMap = jasperPrint.getPropertiesMap(); if (hintsMap != null) { List<PropertySuffix> properties = JRPropertiesUtil.getProperties(hintsMap, propertyPrefix); if (properties != null && !properties.isEmpty()) { values = new String[properties.size()]; for(int i = 0; i < values.length; i++) { values[i] = properties.get(i).getValue(); } } } else { values = (String[])parameters.get(parameter); } return values; }
/** * Return the keys of all the properties available for the import. * The properties are deserialized from the string inside the configuration file. At this properties * are also added the default one if they are not specified */ @Override protected Collection<Object> getInFields(){ List<Object> readKeys = new ArrayList<Object>(); IReportDescriptor selectedConfig = ((ImportJSSAdapterWizard)getWizard()).getSelectedConfiguration(); String propertyString = selectedConfig.getConfiguration().getProperty(PreferencesUtils.NET_SF_JASPERREPORTS_JRPROPERTIES); prop = PreferencesUtils.loadJasperReportsProperties(propertyString); Set<String> storedKeys = prop.stringPropertyNames(); for(String key :storedKeys){ readKeys.add(key); } //Add the default one List<PropertySuffix> lst = PropertiesHelper.DPROP.getProperties(""); for (PropertySuffix ps : lst) { if (prop.getProperty(ps.getKey()) == null) { readKeys.add(ps.getKey()); prop.setProperty(ps.getKey(), ps.getValue()); } } return readKeys; }
protected void doLoadDefault() { if (getTable() != null) { IPreferenceStore pstore = getPreferenceStore(); for (String key : removed) pstore.setValue(key, pstore.getDefaultString(key)); removed.clear(); getTable().removeAll(); List<PropertySuffix> lst = PropertiesHelper.DPROP.getProperties(""); //$NON-NLS-1$ // Collections.sort(lst, new PropertyComparator()); for (PropertySuffix ps : lst) { TableItem tableItem = new TableItem(getTable(), SWT.NONE); tableItem.setText(new String[] { ps.getKey(), ps.getValue() }); } } }
@Override protected Sheet createSheet() { Sheet sheet = super.createSheet(); Sheet.Set set = createSet("JasperReports properties",null); List props = IRLocalJasperReportsContext.getUtilities().getProperties(""); for (int i=0; i<props.size(); ++i) { PropertySuffix prop = (PropertySuffix)props.get(i); set.put(new StringProperty(prop.getKey())); } sheet.put(set); return sheet; }
/** * */ protected boolean checkResourceName(JasperReportsContext jasperReportsContext, String resourceName) { boolean matched = false; List<PropertySuffix> patternProps = JRPropertiesUtil.getInstance(jasperReportsContext).getProperties(PROPERTIES_WEB_RESOURCE_PATTERN_PREFIX);//FIXMESORT cache this for (Iterator<PropertySuffix> patternIt = patternProps.iterator(); patternIt.hasNext();) { JRPropertiesUtil.PropertySuffix patternProp = patternIt.next(); String patternStr = patternProp.getValue(); if (patternStr != null && patternStr.length() > 0) { Pattern resourcePattern = Pattern.compile(patternStr); if (resourcePattern.matcher(resourceName).matches()) { if (log.isDebugEnabled()) { log.debug("resource " + resourceName + " matched pattern " + resourcePattern); } matched = true; break; } } } if (!matched) { if (log.isDebugEnabled()) { log.debug("Resource " + resourceName + " does not matched any allowed pattern"); } // throw new JRRuntimeException("Resource " + resourceName // + " does not matched any allowed pattern"); } return matched; }
@Override public ExtensionsRegistry createRegistry(String registryId, JRPropertiesMap properties) { List<PropertySuffix> contentTypeMappingProperties = JRPropertiesUtil.getProperties(properties, CONTENT_TYPE_MAPPING_PROPERTY_PREFIX); List<ContentTypeMapping> contentTypeMappings = new ArrayList<ContentTypeMapping>(); for (Iterator<PropertySuffix> it = contentTypeMappingProperties.iterator(); it.hasNext();) { PropertySuffix contentTypeMappingProp = it.next(); contentTypeMappings.add(new ContentTypeMapping(contentTypeMappingProp.getSuffix(),contentTypeMappingProp.getValue())); } return new ListExtensionRegistry<ContentTypeMapping>(ContentTypeMapping.class, contentTypeMappings); }
@Override public String[] getLanguages() { List<String> languages = new ArrayList<String>(); List<PropertySuffix> properties = JRPropertiesUtil.getInstance(jasperReportsContext).getProperties(QueryExecuterFactory.QUERY_EXECUTER_FACTORY_PREFIX); for (Iterator<PropertySuffix> it = properties.iterator(); it.hasNext();) { PropertySuffix property = it.next(); languages.add(property.getSuffix()); } return languages.toArray(new String[languages.size()]); }
@Override public StyleProvider getStyleProvider(StyleProviderContext context, JasperReportsContext jasperreportsContext) { Map<String, JRPropertyExpression> stylePropertyExpressions = null; JRPropertyExpression[] propertyExpressions = context.getElement().getPropertyExpressions(); if (propertyExpressions != null) { for(JRPropertyExpression propertyExpression : propertyExpressions) { if (propertyExpression.getName().startsWith(PropertyStyleProvider.STYLE_PROPERTY_PREFIX)) { if (stylePropertyExpressions == null) { stylePropertyExpressions = new HashMap<String, JRPropertyExpression>(); } stylePropertyExpressions.put(propertyExpression.getName(), propertyExpression); } } } List<PropertySuffix> styleProperties = JRPropertiesUtil.getProperties(context.getElement(), PropertyStyleProvider.STYLE_PROPERTY_PREFIX); if ( stylePropertyExpressions != null || (styleProperties != null && styleProperties.size() > 0) ) { return new PropertyStyleProvider(context, stylePropertyExpressions); } return null; }
protected static synchronized void registerFonts () { if (!fontsRegistered) { List<PropertySuffix> fontFiles = JRPropertiesUtil.getInstance(DefaultJasperReportsContext.getInstance()).getProperties(PDF_FONT_FILES_PREFIX);//FIXMECONTEXT no default here and below if (!fontFiles.isEmpty()) { for (Iterator<PropertySuffix> i = fontFiles.iterator(); i.hasNext();) { JRPropertiesUtil.PropertySuffix font = i.next(); String file = font.getValue(); if (file.toLowerCase().endsWith(".ttc")) { FontFactory.register(file); } else { String alias = font.getSuffix(); FontFactory.register(file, alias); } } } List<PropertySuffix> fontDirs = JRPropertiesUtil.getInstance(DefaultJasperReportsContext.getInstance()).getProperties(PDF_FONT_DIRS_PREFIX); if (!fontDirs.isEmpty()) { for (Iterator<PropertySuffix> i = fontDirs.iterator(); i.hasNext();) { JRPropertiesUtil.PropertySuffix dir = i.next(); FontFactory.registerDirectory(dir.getValue()); } } fontsRegistered = true; } }
/** * The exported report is searched for element exclusion properties, and * if any is found a {@link ElementKeyExporterFilter} instance is returned. * * Each property results in a excluded element key in the following manner: * <ul> * <li>If the property value is not empty, it is used as excluded element key.</li> * <li>Otherwise, the property suffix is used as element key.</li> * </ul> * * @see #PROPERTY_EXCLUDED_KEY_PREFIX */ @Override public ExporterFilter getFilter(JRExporterContext exporterContext) throws JRException { ExporterFilter filter = null; JRAbstractExporter<?, ?, ?, ?> exporter = exporterContext.getExporterRef() instanceof JRAbstractExporter<?, ?, ?, ?> ? (JRAbstractExporter<?, ?, ?, ?>)exporterContext.getExporterRef() : null; if (exporter != null) { String excludeKeyPrefix = exporter.getExporterPropertiesPrefix() + PROPERTY_EXCLUDED_KEY_PREFIX; JRPropertiesUtil propsUtil = JRPropertiesUtil.getInstance( exporterContext.getJasperReportsContext()); List<PropertySuffix> props = propsUtil.getAllProperties( exporterContext.getExportedReport(), excludeKeyPrefix); if (!props.isEmpty()) { Set<String> excludedKeys = new HashSet<String>(); for (Iterator<PropertySuffix> it = props.iterator(); it.hasNext();) { PropertySuffix prop = it.next(); String key = prop.getValue(); if (key == null || key.length() == 0) { key = prop.getSuffix(); } excludedKeys.add(key); } filter = new ElementKeyExporterFilter(excludedKeys); } } return filter; }
public List<PropertySuffix> getRowLevelSuffixes(JRPrintElement element) { if (element.hasProperties()) { return JRPropertiesUtil.getProperties(element,JRXlsAbstractExporter.PROPERTY_ROW_OUTLINE_LEVEL_PREFIX); } return null; }
private static JROriginExporterFilter addOriginsToFilter( JasperReportsContext jasperReportsContext, JROriginExporterFilter filter, JRPropertiesMap propertiesMap, String originFilterPrefix, boolean keepFirst ) { JRPropertiesUtil propUtil = JRPropertiesUtil.getInstance(jasperReportsContext); List<PropertySuffix> properties = propUtil.getProperties(originFilterPrefix + BAND_PREFIX); properties.addAll(JRPropertiesUtil.getProperties(propertiesMap, originFilterPrefix + BAND_PREFIX)); if (!properties.isEmpty()) { filter = (filter == null ? new JROriginExporterFilter(): filter); for(Iterator<PropertySuffix> it = properties.iterator(); it.hasNext();) { PropertySuffix propertySuffix = it.next(); String suffix = propertySuffix.getSuffix(); String propValue = propUtil.getProperty(propertiesMap, propertySuffix.getKey()); BandTypeEnum bandType = BandTypeEnum.getByName(propValue == null ? null : propValue.trim()); if (bandType != null) { filter.addOrigin( new JROrigin( propUtil.getProperty(propertiesMap, originFilterPrefix + REPORT_PREFIX + suffix), propUtil.getProperty(propertiesMap, originFilterPrefix + GROUP_PREFIX + suffix), bandType ), keepFirst ); } } } return filter; }
protected void configureDefinedNames(PropertySuffix[] names) { if (names != null) { for (PropertySuffix definedName : names) { configureDefinedNames(definedName); } } }
protected List<ExtensionsRegistry> loadRegistries(JRPropertiesMap properties, Map<String, Exception> registryExceptions) { List<ExtensionsRegistry> registries = new ArrayList<ExtensionsRegistry>(); List<PropertySuffix> factoryProps = JRPropertiesUtil.getProperties(properties, PROPERTY_REGISTRY_FACTORY_PREFIX); for (Iterator<PropertySuffix> it = factoryProps.iterator(); it.hasNext();) { PropertySuffix factoryProp = it.next(); String registryId = factoryProp.getSuffix(); String factoryClass = factoryProp.getValue(); if (log.isDebugEnabled()) { log.debug("Instantiating registry of type " + factoryClass + " for property " + factoryProp.getKey()); } try { ExtensionsRegistry registry = instantiateRegistry( properties, registryId, factoryClass); registries.add(registry); } catch (Exception e) { //skip this registry //error logging is deferred after the registries are cached to avoid a loop from JRRuntimeException.resolveMessage registryExceptions.put(registryId, e); } } return registries; }
@Override public ExtensionsRegistry createRegistry(String registryId, JRPropertiesMap properties) { List<PropertySuffix> categoryProperties = JRPropertiesUtil.getProperties(properties, IDENTITY_SECTRETS_PROVIDER_CATEGORY_PROPERTY_PREFIX); Set<String> categories = new HashSet<String>(); for (Iterator<PropertySuffix> it = categoryProperties.iterator(); it.hasNext();) { PropertySuffix categoryProp = it.next(); categories.add(categoryProp.getValue()); } return new SingletonExtensionRegistry<SecretsProviderFactory>(SecretsProviderFactory.class, new IdentitySecretsProviderFactory(categories)); }
@Override public ExtensionsRegistry createRegistry(String registryId, JRPropertiesMap properties) { List<PropertySuffix> castorMappingProperties = JRPropertiesUtil.getProperties(properties, CASTOR_MAPPING_PROPERTY_PREFIX); List<CastorMapping> castorMappings = new ArrayList<CastorMapping>(); for (Iterator<PropertySuffix> it = castorMappingProperties.iterator(); it.hasNext();) { PropertySuffix castorMappingProp = it.next(); String key; String version; String suffix = castorMappingProp.getSuffix(); int versionSeparatorIndex = suffix.lastIndexOf(CASTOR_MAPPING_VERSION_SEPARATOR); if (versionSeparatorIndex < 0) { key = suffix; version = null; } else { key = suffix.substring(0, versionSeparatorIndex); version = suffix.substring(versionSeparatorIndex + 1, suffix.length()); } String castorMappingPath = castorMappingProp.getValue(); CastorMapping mapping = new CastorMapping(key, version, castorMappingPath); castorMappings.add(mapping); } return new ListExtensionRegistry<CastorMapping>(CastorMapping.class, castorMappings); }
public static String[] getMarkups(JasperReportsConfiguration jrContext) { List<String> lst = new ArrayList<String>(); lst.add(""); //$NON-NLS-1$ lst.add("none"); //$NON-NLS-1$ lst.add("styled"); //$NON-NLS-1$ List<PropertySuffix> props = JRPropertiesUtil.getInstance(jrContext).getProperties( MarkupProcessorFactory.PROPERTY_MARKUP_PROCESSOR_FACTORY_PREFIX); for (PropertySuffix p : props) { lst.add(p.getSuffix()); } return lst.toArray(new String[lst.size()]); }
protected void doLoadDefault() { if (getTable() != null) { getTable().removeAll(); List<PropertySuffix> lst = PropertiesHelper.DPROP.getProperties(""); //$NON-NLS-1$ Collections.sort(lst, new PropertyComparator()); for (PropertySuffix ps : lst) { TableItem tableItem = new TableItem(getTable(), SWT.NONE); tableItem.setText(new String[] { ps.getKey(), ps.getValue() }); } } }
public void store() { DefaultTableModel dtm = (DefaultTableModel) jTable1.getModel(); List<String> usedKeys = new ArrayList<String>(); for (int i=0; i<dtm.getRowCount(); ++i) { String key = (String) dtm.getValueAt(i, 0); String value = (String) dtm.getValueAt(i, 1); usedKeys.add(key); if (!IRLocalJasperReportsContext.isJasperReportsDefaultProperty(key, Misc.removeSlashesString(value), false)) { IReportManager.getPreferences().put(IReportManager.PROPERTY_JRPROPERTY_PREFIX + key, Misc.removeSlashesString(value)); } } // Check removed keys... List props = IRLocalJasperReportsContext.getUtilities().getProperties(""); for (int i=0; i<props.size(); ++i) { String oldKey = ((PropertySuffix)props.get(i)).getKey(); if (!usedKeys.contains(oldKey)) { IReportManager.getPreferences().remove(IReportManager.PROPERTY_JRPROPERTY_PREFIX + oldKey); IRLocalJasperReportsContext.getInstance().removeProperty(oldKey); } } // No need to reload anything... //IReportManager.getInstance().reloadJasperReportsProperties(); }
@Override public ExtensionsRegistry createRegistry(String registryId, JRPropertiesMap properties) { List<PropertySuffix> fontFamiliesProperties = JRPropertiesUtil.getProperties(properties, SYSTEM_FONT_FAMILIES_PROPERTY_PREFIX); List<String> fontFamiliesLocations = new ArrayList<String>(); if (Defaults.getDefaults().isLoadSystemFonts()) { for (Iterator<PropertySuffix> it = fontFamiliesProperties.iterator(); it.hasNext();) { PropertySuffix fontFamiliesProp = it.next(); String fontFamiliesLocation = fontFamiliesProp.getValue(); fontFamiliesLocations.add(fontFamiliesLocation); } } return new FontExtensionsRegistry(fontFamiliesLocations); }
/** * Creates the EJBQL query object. * * @param queryString the query string */ protected synchronized void createQuery(String queryString) { if (log.isDebugEnabled()) { log.debug("EJBQL query: " + queryString); } query = em.createQuery(queryString); // Set parameters. List<String> parameterNames = getCollectedParameterNames(); if (!parameterNames.isEmpty()) { // Use set to prevent the parameter to be set multiple times. Set<String> namesSet = new HashSet<String>(); for (Iterator<String> iter = parameterNames.iterator(); iter.hasNext();) { String parameterName = iter.next(); if (namesSet.add(parameterName)) { JRValueParameter parameter = getValueParameter(parameterName); String ejbParamName = getEjbqlParameterName(parameterName); Object paramValue = parameter.getValue(); if (log.isDebugEnabled()) { log.debug("Parameter " + ejbParamName + ": " + paramValue); } query.setParameter(ejbParamName, paramValue); } } } // Set query hints. // First, set query hints supplied by the JPA_QUERY_HINTS_MAP parameter. Map<String,Object> queryHintsMap = (Map<String,Object>)getParameterValue(JRJpaQueryExecuterFactory.PARAMETER_JPA_QUERY_HINTS_MAP); if (queryHintsMap != null) { for (Iterator<Map.Entry<String,Object>> i = queryHintsMap.entrySet().iterator(); i.hasNext(); ) { Map.Entry<String,Object> pairs = i.next(); if (log.isDebugEnabled()) { log.debug("EJBQL query hint [" + pairs.getKey() + "] set."); } query.setHint(pairs.getKey(), pairs.getValue()); } } // Second, set query hints supplied by report properties which start with JREjbPersistenceQueryExecuterFactory.PROPERTY_JPA_PERSISTENCE_QUERY_HINT_PREFIX // Example: net.sf.jasperreports.ejbql.query.hint.fetchSize // This property will result in a query hint set with the name: fetchSize List<PropertySuffix> properties = JRPropertiesUtil.getProperties(dataset, JRJpaQueryExecuterFactory.PROPERTY_JPA_QUERY_HINT_PREFIX); for (Iterator<PropertySuffix> it = properties.iterator(); it.hasNext();) { PropertySuffix property = it.next(); String queryHint = property.getSuffix(); if (queryHint.length() > 0) { String value = property.getValue(); if (log.isDebugEnabled()) { log.debug("EJBQL query hint [" + queryHint + "] set to: " + value); } query.setHint(queryHint, value); } } }
@Override public ExtensionsRegistry createRegistry(String registryId, JRPropertiesMap properties) { List<PropertySuffix> exportFilterMappingProperties = JRPropertiesUtil.getProperties(properties, MATCHER_EXPORT_FILTER_MAPPING_PROPERTY_PREFIX); List<MatcherExportFilterMapping> exportFilterMappings = new ArrayList<MatcherExportFilterMapping>(); for (Iterator<PropertySuffix> it = exportFilterMappingProperties.iterator(); it.hasNext();) { PropertySuffix exportFilterMappingProp = it.next(); String exporterKey = null; boolean isIncludes = true; String propSuffix = exportFilterMappingProp.getSuffix(); if (propSuffix.endsWith(MATCHER_EXPORT_FILTER_MAPPING_INCLUDES_PROPERTY_SUFFIX)) { exporterKey = propSuffix.substring(0, propSuffix.length() - MATCHER_EXPORT_FILTER_MAPPING_INCLUDES_PROPERTY_SUFFIX.length()); isIncludes = true; } else if (propSuffix.endsWith(MATCHER_EXPORT_FILTER_MAPPING_EXCLUDES_PROPERTY_SUFFIX)) { exporterKey = propSuffix.substring(0, propSuffix.length() - MATCHER_EXPORT_FILTER_MAPPING_EXCLUDES_PROPERTY_SUFFIX.length()); isIncludes = false; } if (exporterKey == null) { if (log.isDebugEnabled()) { log.debug("Matcher mapping property suffix is invalid : " + propSuffix); } } else { exportFilterMappings.add( new MatcherExportFilterMapping( exporterKey, exportFilterMappingProp.getValue(), isIncludes ) ); } } return new ListExtensionRegistry<MatcherExportFilterMapping>(MatcherExportFilterMapping.class, exportFilterMappings); }
/** * */ protected boolean hasGlobalSheetNames()//FIXMEEXPORT check sheet names { Boolean globalSheetNames = null; boolean isOverrideHintsDefault = propertiesUtil.getBooleanProperty( ReportExportConfiguration.PROPERTY_EXPORT_CONFIGURATION_OVERRIDE_REPORT_HINTS ); if ( itemConfiguration != null && itemConfiguration.getSheetNames() != null ) { boolean isExporterConfigOverrideHints = itemConfiguration.isOverrideHints() == null ? isOverrideHintsDefault : itemConfiguration.isOverrideHints(); if (isExporterConfigOverrideHints) { globalSheetNames = true; } } if (globalSheetNames == null) { XlsReportConfiguration lcItemConfiguration = (XlsReportConfiguration)crtItem.getConfiguration(); if ( lcItemConfiguration != null && lcItemConfiguration.getSheetNames() != null ) { boolean isItemConfigOverrideHints = lcItemConfiguration.isOverrideHints() == null ? isOverrideHintsDefault : lcItemConfiguration.isOverrideHints(); if (isItemConfigOverrideHints) { globalSheetNames = false; } } } if (globalSheetNames == null) { List<PropertySuffix> properties = JRPropertiesUtil.getProperties( getCurrentJasperPrint(), XlsReportConfiguration.PROPERTY_SHEET_NAMES_PREFIX ); globalSheetNames = properties == null || properties.isEmpty(); } return globalSheetNames; }
/** * Returns an array of strings representing defined names in the generated workbook. * @see #PROPERTY_DEFINED_NAMES_PREFIX */ @ExporterProperty( value=PROPERTY_DEFINED_NAMES_PREFIX ) public PropertySuffix[] getDefinedNames();
@Override public PropertySuffix[] getDefinedNames() { return definedNames; }
/** * */ public void setDefinedNames(PropertySuffix[] definedNames) { this.definedNames = definedNames; }