List of usage examples for com.liferay.portal.kernel.util SortedArrayList SortedArrayList
public SortedArrayList()
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); }/*ww w . j a v a 2 s . c om*/ 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.events.global.mobile.Utils.java
License:Open Source License
public static String generateSig(Map<String, String> args) { if (Validator.isNull(sigSharedSecret)) { sigSharedSecret = PortletProps.get("liferay.events.shared.secret"); if (sigSharedSecret == null) { sigSharedSecret = "some-hard-to-guess-string"; }/*from ww w . ja v a 2 s.c o m*/ } List<String> sortedArgs = new SortedArrayList<String>(); sortedArgs.addAll(args.keySet()); String preSig = sigSharedSecret; for (String paramName : sortedArgs) { preSig += (paramName + "=" + args.get(paramName)); } return DigesterUtil.digestHex(Digester.SHA_256, preSig); }
From source file:com.liferay.events.global.mobile.Utils.java
License:Open Source License
public static boolean isValidSignature(Map<String, String> args, String sig) throws SystemException { if (!Utils.flag) return false; if (Validator.isNull(sigSharedSecret)) { //sigSharedSecret = PrefsPropsUtil.getString("liferay.events.shared.secret", "some hard-to-guess string"); sigSharedSecret = PortletProps.get("liferay.events.shared.secret"); if (sigSharedSecret == null) { sigSharedSecret = "some-hard-to-guess-string"; }//w w w . j a va 2 s . c om } List<String> sortedArgs = new SortedArrayList<String>(); sortedArgs.addAll(args.keySet()); String preSig = sigSharedSecret; for (String paramName : sortedArgs) { preSig += (paramName + "=" + args.get(paramName)); } String shaSig = DigesterUtil.digestHex(Digester.SHA_256, preSig); return shaSig.equals(sig); }
From source file:com.liferay.portlet.documentlibrary.service.impl.DLFileEntryTypeLocalServiceImpl.java
License:Open Source License
protected List<Long> getFileEntryTypeIds(List<DLFileEntryType> dlFileEntryTypes) { List<Long> fileEntryTypeIds = new SortedArrayList<Long>(); for (DLFileEntryType dlFileEntryType : dlFileEntryTypes) { fileEntryTypeIds.add(dlFileEntryType.getFileEntryTypeId()); }//from ww w .ja va2 s . c o m return fileEntryTypeIds; }
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 ww . j a va2s. 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("Conversions supported from " + sourceExtension + " to " + conversions); } _conversionsMap.put(sourceExtension, conversions.toArray(new String[conversions.size()])); } } }