Java 类net.sf.jasperreports.engine.JRPropertiesUtil.PropertySuffix 实例源码

项目:jasperreports    文件:XmlChartThemeExtensionsRegistryFactory.java   
@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);
}
项目:jasperreports    文件:JacksonMappingExtensionsRegistryFactory.java   
@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);
}
项目:jasperreports    文件:RequirejsConfigTemplateExtensionFactory.java   
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);
    }
}
项目:jasperreports    文件:RequirejsConfigTemplateExtensionFactory.java   
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);
    }
}
项目:jasperreports    文件:RequirejsModuleMappingExtensionsRegistryFactory.java   
@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);
}
项目:jasperreports    文件:SimpleFontExtensionsRegistryFactory.java   
@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);
}
项目:jasperreports    文件:JaxenXPathQueryExecuter.java   
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;
}
项目:jasperreports    文件:XalanXPathQueryExecuter.java   
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;
}
项目:jasperreports    文件:JRXmlWriter.java   
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);
}
项目:jasperreports    文件:JRPdfExporter.java   
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);
            }
        }
    }
}
项目:jasperreports    文件:JRXlsAbstractExporterNature.java   
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;
}
项目:jasperreports    文件:JRXlsAbstractExporter.java   
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]);
                }
            }
        }
    }
}
项目:jasperreports    文件:FunctionsRegistryFactory.java   
/**
 * 
 */
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);
            }
        }
    }
}
项目:jasperreports    文件:ParameterOverrideResolver.java   
@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;
}
项目:jasperreports    文件:ParameterOverriddenResolver.java   
@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;
}
项目:PDFReporter-Studio    文件:JSSPropertiesPage.java   
/**
 *  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;
}
项目:PDFReporter-Studio    文件:ParameterSetFieldEditor.java   
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() });
        }
    }
}
项目:ireport-fork    文件:JRPropertiesNode.java   
@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;
}
项目:jasperreports    文件:DefaultWebResourceHandler.java   
/**
     * 
     */
    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;
    }
项目:jasperreports    文件:ContentTypeMappingExtensionsRegistryFactory.java   
@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);
}
项目:jasperreports    文件:DefaultQueryExecuterFactoryBundle.java   
@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()]);
}
项目:jasperreports    文件:PropertyStyleProviderFactory.java   
@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;
}
项目:jasperreports    文件:JRPdfExporter.java   
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;
    }
}
项目:jasperreports    文件:ElementKeyExporterFilterFactory.java   
/**
 * 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;
}
项目:jasperreports    文件:JRXlsAbstractExporterNature.java   
public List<PropertySuffix> getRowLevelSuffixes(JRPrintElement element)
{
    if (element.hasProperties())
    {
        return JRPropertiesUtil.getProperties(element,JRXlsAbstractExporter.PROPERTY_ROW_OUTLINE_LEVEL_PREFIX);
    }
    return null;

}
项目:jasperreports    文件:JROriginExporterFilter.java   
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;
}
项目:jasperreports    文件:JRXlsAbstractExporter.java   
protected void configureDefinedNames(PropertySuffix[] names)
{
    if (names != null)
    {
        for (PropertySuffix definedName : names)
        {
            configureDefinedNames(definedName);
        }
    }
}
项目:jasperreports    文件:DefaultExtensionsRegistry.java   
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;
}
项目:jasperreports    文件:IdentitySecretsProviderExtensionsRegistryFactory.java   
@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));
}
项目:jasperreports    文件:CastorMappingExtensionsRegistryFactory.java   
@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);
}
项目:PDFReporter-Studio    文件:ModelUtils.java   
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()]);
}
项目:PDFReporter-Studio    文件:PropertyListFieldEditor.java   
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() });
        }
    }
}
项目:ireport-fork    文件:JROptionsPanel.java   
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();
    }
项目:dynamicreports-jasper    文件:JasperSystemFontExtensionsRegistryFactory.java   
@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);
}
项目:jasperreports    文件:JRJpaQueryExecuter.java   
/**
 * 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);
        }
    }
}
项目:jasperreports    文件:MatcherExportFilterMappingExtensionsRegistryFactory.java   
@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);
}
项目:jasperreports    文件:JRXlsAbstractExporter.java   
/**
 * 
 */
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;
}
项目:jasperreports    文件:XlsReportConfiguration.java   
/**
 * 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();
项目:jasperreports    文件:AbstractXlsReportConfiguration.java   
@Override
public PropertySuffix[] getDefinedNames()
{
    return definedNames;
}
项目:jasperreports    文件:AbstractXlsReportConfiguration.java   
/**
 * 
 */
public void setDefinedNames(PropertySuffix[] definedNames)
{
    this.definedNames = definedNames;
}