Example usage for com.liferay.portal.util PropsUtil get

List of usage examples for com.liferay.portal.util PropsUtil get

Introduction

In this page you can find the example usage for com.liferay.portal.util PropsUtil get.

Prototype

public static String get(String key, Filter filter) 

Source Link

Usage

From source file:com.liferay.portlet.documentlibrary.util.PDFProcessorImpl.java

License:Open Source License

public String getGlobalSearchPath() throws Exception {
    PortletPreferences preferences = PrefsPropsUtil.getPreferences();

    String globalSearchPath = preferences.getValue(PropsKeys.IMAGEMAGICK_GLOBAL_SEARCH_PATH, null);

    if (Validator.isNotNull(globalSearchPath)) {
        return globalSearchPath;
    }/*from  w  w  w.j  ava2s .c o m*/

    String filterName = null;

    if (OSDetector.isApple()) {
        filterName = "apple";
    } else if (OSDetector.isWindows()) {
        filterName = "windows";
    } else {
        filterName = "unix";
    }

    return PropsUtil.get(PropsKeys.IMAGEMAGICK_GLOBAL_SEARCH_PATH, new Filter(filterName));
}

From source file:com.liferay.portlet.dynamicdatalists.util.DDLTransformer.java

License:Open Source License

@Override
protected String getTemplateParserClassName(String langType) {
    return PropsUtil.get(PropsKeys.DYNAMIC_DATA_LISTS_TEMPLATE_LANGUAGE_PARSER, new Filter(langType));
}

From source file:com.liferay.portlet.journal.util.JournalTransformer.java

License:Open Source License

@Override
protected String getTemplateParserClassName(String langType) {
    return PropsUtil.get(PropsKeys.JOURNAL_TEMPLATE_LANGUAGE_PARSER, new Filter(langType));
}

From source file:com.liferay.portlet.journal.util.JournalUtil.java

License:Open Source License

private static void _populateCustomTokens(Map<String, String> tokens) {
    if (_customTokens == null) {
        synchronized (JournalUtil.class) {
            _customTokens = new HashMap<String, String>();

            for (String customToken : PropsValues.JOURNAL_ARTICLE_CUSTOM_TOKENS) {

                String value = PropsUtil.get(PropsKeys.JOURNAL_ARTICLE_CUSTOM_TOKEN_VALUE,
                        new Filter(customToken));

                _customTokens.put(customToken, value);
            }/*  ww w  . j av a2  s. com*/
        }
    }

    if (!_customTokens.isEmpty()) {
        tokens.putAll(_customTokens);
    }
}

From source file:com.liferay.portlet.wiki.service.impl.WikiNodeLocalServiceImpl.java

License:Open Source License

protected WikiImporter getWikiImporter(String importer) throws SystemException {

    WikiImporter wikiImporter = _wikiImporters.get(importer);

    if (wikiImporter == null) {
        String importerClass = PropsUtil.get(PropsKeys.WIKI_IMPORTERS_CLASS, new Filter(importer));

        if (importerClass != null) {
            wikiImporter = (WikiImporter) InstancePool.get(importerClass);

            _wikiImporters.put(importer, wikiImporter);
        }//from   w w  w.jav a 2 s.  com

        if (importer == null) {
            throw new SystemException("Unable to instantiate wiki importer class " + importerClass);
        }
    }

    return wikiImporter;
}

From source file:com.liferay.portlet.wiki.util.WikiUtil.java

License:Open Source License

private String _getEditPage(String format) {
    return PropsUtil.get(PropsKeys.WIKI_FORMATS_EDIT_PAGE, new Filter(format));
}

From source file:com.liferay.portlet.wiki.util.WikiUtil.java

License:Open Source License

private WikiEngine _getEngine(String format) throws WikiFormatException {
    WikiEngine engine = _engines.get(format);

    if (engine != null) {
        return engine;
    }/*from ww  w  . ja v a 2s  .  com*/

    synchronized (_engines) {
        engine = _engines.get(format);

        if (engine != null) {
            return engine;
        }

        try {
            String engineClass = PropsUtil.get(PropsKeys.WIKI_FORMATS_ENGINE, new Filter(format));

            if (engineClass == null) {
                throw new WikiFormatException(format);
            }

            if (!InstancePool.contains(engineClass)) {
                engine = (WikiEngine) InstancePool.get(engineClass);

                engine.setMainConfiguration(
                        _readConfigurationFile(PropsKeys.WIKI_FORMATS_CONFIGURATION_MAIN, format));

                engine.setInterWikiConfiguration(
                        _readConfigurationFile(PropsKeys.WIKI_FORMATS_CONFIGURATION_INTERWIKI, format));
            } else {
                engine = (WikiEngine) InstancePool.get(engineClass);
            }

            _engines.put(format, engine);

            return engine;
        } catch (Exception e) {
            throw new WikiFormatException(e);
        }
    }
}

From source file:com.liferay.portlet.wiki.util.WikiUtil.java

License:Open Source License

private String _getHelpPage(String format) {
    return PropsUtil.get(PropsKeys.WIKI_FORMATS_HELP_PAGE, new Filter(format));
}

From source file:com.liferay.portlet.wiki.util.WikiUtil.java

License:Open Source License

private String _getHelpURL(String format) {
    return PropsUtil.get(PropsKeys.WIKI_FORMATS_HELP_URL, new Filter(format));
}

From source file:com.liferay.portlet.wiki.util.WikiUtil.java

License:Open Source License

private String _readConfigurationFile(String propertyName, String format) throws IOException {

    ClassLoader classLoader = getClass().getClassLoader();

    String configurationFile = PropsUtil.get(propertyName, new Filter(format));

    if (Validator.isNotNull(configurationFile)) {
        return HttpUtil.URLtoString(classLoader.getResource(configurationFile));
    } else {/*from www. j  av  a2  s  .c  o  m*/
        return StringPool.BLANK;
    }
}