List of usage examples for com.liferay.portal.kernel.messaging DestinationNames DOCUMENT_LIBRARY_PDF_PROCESSOR
String DOCUMENT_LIBRARY_PDF_PROCESSOR
To view the source code for com.liferay.portal.kernel.messaging DestinationNames DOCUMENT_LIBRARY_PDF_PROCESSOR.
Click Source Link
From source file:com.liferay.document.library.service.test.PDFProcessorTest.java
License:Open Source License
protected static AtomicInteger registerPDFProcessorMessageListener(final EventType eventType) { final AtomicInteger count = new AtomicInteger(); MessageBusUtil.registerMessageListener(DestinationNames.DOCUMENT_LIBRARY_PDF_PROCESSOR, new MessageListener() { @Override//from w w w . j a v a 2 s. c o m public void receive(Message message) { Object[] payload = (Object[]) message.getPayload(); if (eventType.isMatch(payload[0])) { count.incrementAndGet(); } } }); return count; }
From source file:com.liferay.portlet.documentlibrary.util.PDFProcessorImpl.java
License:Open Source License
private void _queueGeneration(FileVersion fileVersion) { if (_fileVersionIds.contains(fileVersion.getFileVersionId())) { return;/* w w w .j a va2 s.c o m*/ } boolean generateImages = false; String extension = fileVersion.getExtension(); if (extension.equals("pdf")) { generateImages = true; } else if (DocumentConversionUtil.isEnabled()) { String[] conversions = DocumentConversionUtil.getConversions(extension); for (String conversion : conversions) { if (conversion.equals("pdf")) { generateImages = true; break; } } } if (generateImages) { _fileVersionIds.add(fileVersion.getFileVersionId()); if (PropsValues.DL_FILE_ENTRY_PROCESSORS_TRIGGER_SYNCHRONOUSLY) { try { MessageBusUtil.sendSynchronousMessage(DestinationNames.DOCUMENT_LIBRARY_PDF_PROCESSOR, fileVersion); } catch (MessageBusException mbe) { if (_log.isWarnEnabled()) { _log.warn(mbe, mbe); } } } else { MessageBusUtil.sendMessage(DestinationNames.DOCUMENT_LIBRARY_PDF_PROCESSOR, fileVersion); } } }