List of usage examples for com.liferay.portal.kernel.configuration Filter Filter
public Filter(String selector1)
From source file:com.liferay.document.library.document.conversion.internal.DocumentConversionImpl.java
License:Open Source License
private void _populateConversionsMap(String documentFamily) { Filter filter = new Filter(documentFamily); DocumentFormatRegistry documentFormatRegistry = new DefaultDocumentFormatRegistry(); String[] sourceExtensions = PropsUtil.getArray(PropsKeys.OPENOFFICE_CONVERSION_SOURCE_EXTENSIONS, filter); String[] targetExtensions = PropsUtil.getArray(PropsKeys.OPENOFFICE_CONVERSION_TARGET_EXTENSIONS, filter); for (String sourceExtension : sourceExtensions) { List<String> conversions = new SortedArrayList<>(); DocumentFormat sourceDocumentFormat = documentFormatRegistry.getFormatByFileExtension(sourceExtension); if (sourceDocumentFormat == null) { if (_log.isWarnEnabled()) { _log.warn("Invalid source extension " + sourceExtension); }/* www .j a va 2 s .c o m*/ continue; } for (String targetExtension : targetExtensions) { DocumentFormat targetDocumentFormat = documentFormatRegistry .getFormatByFileExtension(targetExtension); if (targetDocumentFormat == null) { if (_log.isWarnEnabled()) { _log.warn("Invalid target extension " + targetDocumentFormat); } continue; } if (sourceDocumentFormat.isExportableTo(targetDocumentFormat)) { conversions.add(targetExtension); } } if (conversions.isEmpty()) { if (_log.isInfoEnabled()) { _log.info("There are no conversions supported from " + sourceExtension); } } else { if (_log.isInfoEnabled()) { _log.info(StringBundler.concat("Conversions supported from ", sourceExtension, " to ", String.valueOf(conversions))); } _conversionsMap.put(sourceExtension, conversions.toArray(new String[conversions.size()])); } } }
From source file:com.liferay.dynamic.data.lists.web.internal.template.DDLDisplayTemplateHandler.java
License:Open Source License
@Override public String getTemplatesHelpPath(String language) { return DDLWebConfigurationUtil.get(getTemplatesHelpPropertyKey(), new Filter(language)); }
From source file:com.liferay.knowledgebase.display.selector.DefaultKBArticleSelectorFactory.java
License:Open Source License
protected KBArticleSelector createKBArticleSelector(String className) throws NoSuchKBArticleSelectorException { try {/*from w ww. j a va2 s . c o m*/ String kbArticleSelectorClassName = PortletProps.get(PortletPropsKeys.KNOWLEDGE_BASE_DISPLAY_SELECTOR, new Filter(className)); if (Validator.isNull(kbArticleSelectorClassName)) { throw new NoSuchKBArticleSelectorException("No KBArticleSelector found for key " + className); } Class<?> kbArticleSelectorClass = Class.forName(kbArticleSelectorClassName); return (KBArticleSelector) kbArticleSelectorClass.newInstance(); } catch (ClassNotFoundException cnfe) { throw new NoSuchKBArticleSelectorException(cnfe); } catch (InstantiationException ie) { throw new NoSuchKBArticleSelectorException(ie); } catch (IllegalAccessException iae) { throw new NoSuchKBArticleSelectorException(iae); } }
From source file:com.liferay.localization.util.InstanceUtil.java
License:Open Source License
private static void _putMap(Map<Locale, String> map, String languageId, String key) { Locale locale = LocaleUtil.fromLanguageId(languageId); String value = PortletProps.get(key, new Filter(languageId)); map.put(locale, value);/*from w ww . ja v a 2s .c om*/ }
From source file:com.liferay.notifications.hook.events.StartupAction.java
License:Open Source License
protected void initUserNotificationDefinitions() { String[] portletIds = PortletPropsValues.USER_NOTIFICATIONS_PORTLET_IDS; for (String portletId : portletIds) { UserNotificationManagerUtil.deleteUserNotificationDefinitions(portletId); Filter filter = new Filter(portletId); String userNotificationDefinitionsLocation = PortletProps .get(PortletPropsKeys.USER_NOTIFICATIONS_DEFINITIONS, filter); try {//from w w w. j a v a2s.c o m String xml = ContentUtil.get(userNotificationDefinitionsLocation); addUserNotificationDefinitions(xml, portletId); } catch (Exception e) { if (_log.isWarnEnabled()) { _log.warn("Unable to add user notification definitions " + userNotificationDefinitionsLocation); } } } }
From source file:com.liferay.notifications.hook.events.StartupAction.java
License:Open Source License
protected void initUserNotificationHandlers() { String[] portletIds = PortletPropsValues.USER_NOTIFICATIONS_PORTLET_IDS; for (String portletId : portletIds) { Filter filter = new Filter(portletId); String userNotificationHandlerClassName = PortletProps.get(PortletPropsKeys.USER_NOTIFICATIONS_HANDLER, filter);//w w w . j a va 2 s . com try { UserNotificationHandler userNotificationHandler = (UserNotificationHandler) InstanceFactory .newInstance(userNotificationHandlerClassName); UserNotificationManagerUtil.deleteUserNotificationHandler(userNotificationHandler); UserNotificationManagerUtil.addUserNotificationHandler(userNotificationHandler); } catch (Exception e) { if (_log.isWarnEnabled()) { _log.warn("Unable to add user notification handler " + userNotificationHandlerClassName); } } } }
From source file:com.liferay.portlet.documentlibrary.util.DLImpl.java
License:Open Source License
private static void _populateGenericNamesMap(String genericName) { String[] extensions = PropsUtil.getArray(PropsKeys.DL_FILE_GENERIC_EXTENSIONS, new Filter(genericName)); for (String extension : extensions) { _genericNames.put(extension, genericName); }//www . j a va2 s .c o m }
From source file:com.liferay.portlet.documentlibrary.util.DocumentConversionUtil.java
License:Open Source License
private void _populateConversionsMap(String documentFamily) { Filter filter = new Filter(documentFamily); DocumentFormatRegistry documentFormatRegistry = new DefaultDocumentFormatRegistry(); String[] sourceExtensions = PropsUtil.getArray(PropsKeys.OPENOFFICE_CONVERSION_SOURCE_EXTENSIONS, filter); String[] targetExtensions = PropsUtil.getArray(PropsKeys.OPENOFFICE_CONVERSION_TARGET_EXTENSIONS, filter); for (String sourceExtension : sourceExtensions) { List<String> conversions = new SortedArrayList<String>(); DocumentFormat sourceDocumentFormat = documentFormatRegistry.getFormatByFileExtension(sourceExtension); if (sourceDocumentFormat == null) { if (_log.isWarnEnabled()) { _log.warn("Invalid source extension " + sourceExtension); }//from w w w .j a v a 2 s.com continue; } for (String targetExtension : targetExtensions) { DocumentFormat targetDocumentFormat = documentFormatRegistry .getFormatByFileExtension(targetExtension); if (targetDocumentFormat == null) { if (_log.isWarnEnabled()) { _log.warn("Invalid target extension " + targetDocumentFormat); } continue; } if (sourceDocumentFormat.isExportableTo(targetDocumentFormat)) { conversions.add(targetExtension); } } if (conversions.isEmpty()) { if (_log.isInfoEnabled()) { _log.info("There are no conversions supported from " + sourceExtension); } } else { if (_log.isInfoEnabled()) { _log.info("Conversions supported from " + sourceExtension + " to " + conversions); } _conversionsMap.put(sourceExtension, conversions.toArray(new String[conversions.size()])); } } }
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 ww w. j av a2s.c om*/ 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)); }