Liferay 6.2-ce-ga5

com.liferay.portlet.documentlibrary.util
Class DLPreviewableProcessor

java.lang.Object
  extended by com.liferay.portlet.documentlibrary.util.DLPreviewableProcessor
All Implemented Interfaces:
DLProcessor

public abstract class DLPreviewableProcessor
extends Object
implements DLProcessor


Field Summary
protected  Map<String,Future<?>> futures
           
static String PREVIEW_PATH
           
static String PREVIEW_TMP_PATH
           
static long REPOSITORY_ID
           
static int THUMBNAIL_INDEX_CUSTOM_1
           
static int THUMBNAIL_INDEX_CUSTOM_2
           
static int THUMBNAIL_INDEX_DEFAULT
           
static String THUMBNAIL_PATH
           
static String THUMBNAIL_TMP_PATH
           
 
Constructor Summary
DLPreviewableProcessor()
           
 
Method Summary
protected  void addFileToStore(long companyId, String dirName, String filePath, File srcFile)
           
protected  void addFileToStore(long companyId, String dirName, String filePath, InputStream is)
           
 void cleanUp(FileEntry fileEntry)
           
 void cleanUp(FileVersion fileVersion)
           
 void copy(FileVersion sourceFileVersion, FileVersion destinationFileVersion)
           
protected  void copyPreviews(FileVersion sourceFileVersion, FileVersion destinationFileVersion)
           
protected  void copyThumbnail(FileVersion sourceFileVersion, FileVersion destinationFileVersion, int index)
           
protected  void copyThumbnails(FileVersion sourceFileVersion, FileVersion destinationFileVersion)
           
static void deleteFiles()
           
 void deleteFiles(FileEntry fileEntry, String thumbnailType)
           
 void deleteFiles(FileVersion fileVersion, String thumbnailType)
           
protected  void deleteFiles(long companyId, long groupId, long fileEntryId, long fileVersionId, String thumbnailType)
           
protected  void deletePreviews(long companyId, long groupId, long fileEntryId, long fileVersionId)
           
protected  void deleteThumbnail(long companyId, long groupId, long fileEntryId, long fileVersionId, String thumbnailType, int index)
           
protected  void deleteThumbnails(long companyId, long groupId, long fileEntryId, long fileVersionId, String thumbnailType)
           
protected  void destroyProcess(String processIdentity)
           
protected abstract  void doExportGeneratedFiles(PortletDataContext portletDataContext, FileEntry fileEntry, Element fileEntryElement)
           
protected  InputStream doGetPreviewAsStream(FileVersion fileVersion, int index, String type)
           
protected  InputStream doGetPreviewAsStream(FileVersion fileVersion, String type)
           
protected  int doGetPreviewFileCount(FileVersion fileVersion)
           
protected  long doGetPreviewFileSize(FileVersion fileVersion, int index)
           
protected  long doGetPreviewFileSize(FileVersion fileVersion, int index, String type)
           
protected  long doGetPreviewFileSize(FileVersion fileVersion, String type)
           
protected  InputStream doGetThumbnailAsStream(FileVersion fileVersion, int index)
           
protected  long doGetThumbnailFileSize(FileVersion fileVersion, int index)
           
protected abstract  void doImportGeneratedFiles(PortletDataContext portletDataContext, FileEntry fileEntry, FileEntry importedFileEntry, Element fileEntryElement)
           
protected  void exportBinary(PortletDataContext portletDataContext, Element fileEntryElement, FileVersion fileVersion, InputStream is, String binPath, String binPathName)
           
 void exportGeneratedFiles(PortletDataContext portletDataContext, FileEntry fileEntry, Element fileEntryElement)
           
protected  void exportPreview(PortletDataContext portletDataContext, FileEntry fileEntry, Element fileEntryElement, String binPathSuffix, String previewType)
           
protected  void exportPreview(PortletDataContext portletDataContext, FileEntry fileEntry, Element fileEntryElement, String binPathSuffix, String previewType, int fileIndex)
           
protected  void exportThumbnail(PortletDataContext portletDataContext, FileEntry fileEntry, Element fileEntryElement, String binPathName, int index)
           
protected  void exportThumbnails(PortletDataContext portletDataContext, FileEntry fileEntry, Element fileEntryElement, String binPathSuffix)
           
protected  String getBinPath(PortletDataContext portletDataContext, FileEntry fileEntry, int index)
           
protected  String getBinPath(PortletDataContext portletDataContext, FileEntry fileEntry, String type)
           
protected abstract  List<Long> getFileVersionIds()
           
protected static String getPathSegment(FileVersion fileVersion, boolean preview)
           
protected static String getPathSegment(long groupId, long fileEntryId, long fileVersionId, boolean preview)
           
protected  String getPreviewFilePath(FileVersion fileVersion)
           
protected  String getPreviewFilePath(FileVersion fileVersion, int index)
           
protected  String getPreviewFilePath(FileVersion fileVersion, int index, String type)
           
protected  String getPreviewFilePath(FileVersion fileVersion, String type)
           
protected  String getPreviewFilePath(long groupId, long fileEntryId, long fileVersionId, int index, String type)
           
protected  String getPreviewFilePath(long groupId, long fileEntryId, long fileVersionId, String type)
           
protected  File getPreviewTempFile(String id)
           
protected  File getPreviewTempFile(String id, int index)
           
protected  File getPreviewTempFile(String id, int index, String type)
           
protected  File getPreviewTempFile(String id, String type)
           
protected  int getPreviewTempFileCount(FileVersion fileVersion)
           
protected  int getPreviewTempFileCount(FileVersion fileVersion, String type)
           
protected  String getPreviewTempFilePath(String id)
           
protected  String getPreviewTempFilePath(String id, int index)
           
protected  String getPreviewTempFilePath(String id, int index, String type)
           
protected  String getPreviewTempFilePath(String id, String type)
           
protected  String getPreviewType()
           
protected abstract  String getPreviewType(FileVersion fileVersion)
           
protected  String getPreviewType(int index)
           
protected  String[] getPreviewTypes()
           
protected  String getThumbnailFilePath(FileVersion fileVersion, int index)
           
protected  String getThumbnailFilePath(FileVersion fileVersion, String type, int index)
           
protected  String getThumbnailFilePath(long groupId, long fileEntryId, long fileVersionId, String thumbnailType, int index)
           
protected  File getThumbnailTempFile(String id)
           
protected  File getThumbnailTempFile(String id, String type)
           
protected  String getThumbnailTempFilePath(String id)
           
protected  String getThumbnailTempFilePath(String id, String type)
           
protected  String getThumbnailType()
           
protected abstract  String getThumbnailType(FileVersion fileVersion)
           
protected  boolean hasPreview(FileVersion fileVersion, String type)
           
protected  boolean hasPreviews(FileVersion fileVersion)
           
protected  boolean hasThumbnail(FileVersion fileVersion, int index)
           
protected  boolean hasThumbnails(FileVersion fileVersion)
           
 void importGeneratedFiles(PortletDataContext portletDataContext, FileEntry fileEntry, FileEntry importedFileEntry, Element fileEntryElement)
           
protected  void importPreview(PortletDataContext portletDataContext, FileEntry fileEntry, FileEntry importedFileEntry, Element fileEntryElement, String binPathSuffix, String previewType)
           
protected  void importPreview(PortletDataContext portletDataContext, FileEntry fileEntry, FileEntry importedFileEntry, Element fileEntryElement, String binPathSuffix, String previewType, int fileIndex)
           
protected  void importPreviewFromLAR(PortletDataContext portletDataContext, FileEntry fileEntry, Element fileEntryElement, String binPathSuffix, String previewType, int fileIndex)
           
protected  void importThumbnail(PortletDataContext portletDataContext, FileEntry fileEntry, FileEntry importedFileEntry, Element fileEntryElement, String binPathName, int index)
           
protected  void importThumbnailFromLAR(PortletDataContext portletDataContext, FileEntry fileEntry, Element fileEntryElement, String binPathName, int index)
           
protected  void importThumbnails(PortletDataContext portletDataContext, FileEntry fileEntry, FileEntry importedFileEntry, Element fileEntryElement, String binPathSuffix)
           
 boolean isSupported(FileVersion fileVersion)
           
protected  boolean isThumbnailEnabled(int index)
           
protected  void sendGenerationMessage(String destinationName, FileVersion sourceFileVersion, FileVersion destinationFileVersion)
           
protected  void storeThumbnailImage(FileVersion fileVersion, RenderedImage renderedImage, int index)
           
protected  void storeThumbnailImages(FileVersion fileVersion, File file)
           
protected  void storeThumbnailImages(FileVersion fileVersion, RenderedImage renderedImage)
           
 void trigger(FileVersion sourceFileVersion, FileVersion destinationFileVersion)
          Launches the processor's work with respect to the given file version.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.liferay.portlet.documentlibrary.util.DLProcessor
afterPropertiesSet, isSupported
 

Field Detail

PREVIEW_PATH

public static final String PREVIEW_PATH
See Also:
Constant Field Values

PREVIEW_TMP_PATH

public static final String PREVIEW_TMP_PATH

REPOSITORY_ID

public static final long REPOSITORY_ID
See Also:
Constant Field Values

THUMBNAIL_INDEX_CUSTOM_1

public static final int THUMBNAIL_INDEX_CUSTOM_1
See Also:
Constant Field Values

THUMBNAIL_INDEX_CUSTOM_2

public static final int THUMBNAIL_INDEX_CUSTOM_2
See Also:
Constant Field Values

THUMBNAIL_INDEX_DEFAULT

public static final int THUMBNAIL_INDEX_DEFAULT
See Also:
Constant Field Values

THUMBNAIL_PATH

public static final String THUMBNAIL_PATH
See Also:
Constant Field Values

THUMBNAIL_TMP_PATH

public static final String THUMBNAIL_TMP_PATH

futures

protected Map<String,Future<?>> futures
Constructor Detail

DLPreviewableProcessor

public DLPreviewableProcessor()
Method Detail

deleteFiles

public static void deleteFiles()

cleanUp

public void cleanUp(FileEntry fileEntry)
Specified by:
cleanUp in interface DLProcessor

cleanUp

public void cleanUp(FileVersion fileVersion)
Specified by:
cleanUp in interface DLProcessor

copy

public void copy(FileVersion sourceFileVersion,
                 FileVersion destinationFileVersion)
Specified by:
copy in interface DLProcessor

deleteFiles

public void deleteFiles(FileEntry fileEntry,
                        String thumbnailType)

deleteFiles

public void deleteFiles(FileVersion fileVersion,
                        String thumbnailType)

exportGeneratedFiles

public void exportGeneratedFiles(PortletDataContext portletDataContext,
                                 FileEntry fileEntry,
                                 Element fileEntryElement)
                          throws Exception
Specified by:
exportGeneratedFiles in interface DLProcessor
Throws:
Exception

importGeneratedFiles

public void importGeneratedFiles(PortletDataContext portletDataContext,
                                 FileEntry fileEntry,
                                 FileEntry importedFileEntry,
                                 Element fileEntryElement)
                          throws Exception
Specified by:
importGeneratedFiles in interface DLProcessor
Throws:
Exception

isSupported

public boolean isSupported(FileVersion fileVersion)
Specified by:
isSupported in interface DLProcessor

trigger

public void trigger(FileVersion sourceFileVersion,
                    FileVersion destinationFileVersion)
Description copied from interface: DLProcessor
Launches the processor's work with respect to the given file version.

Specified by:
trigger in interface DLProcessor
Parameters:
sourceFileVersion - the file version to copy previews and thumbnails from (optionally null)
destinationFileVersion - the latest file version to process

getPathSegment

protected static String getPathSegment(FileVersion fileVersion,
                                       boolean preview)

getPathSegment

protected static String getPathSegment(long groupId,
                                       long fileEntryId,
                                       long fileVersionId,
                                       boolean preview)

addFileToStore

protected void addFileToStore(long companyId,
                              String dirName,
                              String filePath,
                              File srcFile)
                       throws PortalException,
                              SystemException
Throws:
PortalException
SystemException

addFileToStore

protected void addFileToStore(long companyId,
                              String dirName,
                              String filePath,
                              InputStream is)
                       throws PortalException,
                              SystemException
Throws:
PortalException
SystemException

copyPreviews

protected void copyPreviews(FileVersion sourceFileVersion,
                            FileVersion destinationFileVersion)

copyThumbnail

protected void copyThumbnail(FileVersion sourceFileVersion,
                             FileVersion destinationFileVersion,
                             int index)

copyThumbnails

protected void copyThumbnails(FileVersion sourceFileVersion,
                              FileVersion destinationFileVersion)

deleteFiles

protected void deleteFiles(long companyId,
                           long groupId,
                           long fileEntryId,
                           long fileVersionId,
                           String thumbnailType)

deletePreviews

protected void deletePreviews(long companyId,
                              long groupId,
                              long fileEntryId,
                              long fileVersionId)

deleteThumbnail

protected void deleteThumbnail(long companyId,
                               long groupId,
                               long fileEntryId,
                               long fileVersionId,
                               String thumbnailType,
                               int index)

deleteThumbnails

protected void deleteThumbnails(long companyId,
                                long groupId,
                                long fileEntryId,
                                long fileVersionId,
                                String thumbnailType)

destroyProcess

protected void destroyProcess(String processIdentity)

doExportGeneratedFiles

protected abstract void doExportGeneratedFiles(PortletDataContext portletDataContext,
                                               FileEntry fileEntry,
                                               Element fileEntryElement)
                                        throws Exception
Throws:
Exception

doGetPreviewAsStream

protected InputStream doGetPreviewAsStream(FileVersion fileVersion,
                                           int index,
                                           String type)
                                    throws PortalException,
                                           SystemException
Throws:
PortalException
SystemException

doGetPreviewAsStream

protected InputStream doGetPreviewAsStream(FileVersion fileVersion,
                                           String type)
                                    throws PortalException,
                                           SystemException
Throws:
PortalException
SystemException

doGetPreviewFileCount

protected int doGetPreviewFileCount(FileVersion fileVersion)
                             throws Exception
Throws:
Exception

doGetPreviewFileSize

protected long doGetPreviewFileSize(FileVersion fileVersion,
                                    int index)
                             throws PortalException,
                                    SystemException
Throws:
PortalException
SystemException

doGetPreviewFileSize

protected long doGetPreviewFileSize(FileVersion fileVersion,
                                    int index,
                                    String type)
                             throws PortalException,
                                    SystemException
Throws:
PortalException
SystemException

doGetPreviewFileSize

protected long doGetPreviewFileSize(FileVersion fileVersion,
                                    String type)
                             throws PortalException,
                                    SystemException
Throws:
PortalException
SystemException

doGetThumbnailAsStream

protected InputStream doGetThumbnailAsStream(FileVersion fileVersion,
                                             int index)
                                      throws PortalException,
                                             SystemException
Throws:
PortalException
SystemException

doGetThumbnailFileSize

protected long doGetThumbnailFileSize(FileVersion fileVersion,
                                      int index)
                               throws PortalException,
                                      SystemException
Throws:
PortalException
SystemException

doImportGeneratedFiles

protected abstract void doImportGeneratedFiles(PortletDataContext portletDataContext,
                                               FileEntry fileEntry,
                                               FileEntry importedFileEntry,
                                               Element fileEntryElement)
                                        throws Exception
Throws:
Exception

exportBinary

protected void exportBinary(PortletDataContext portletDataContext,
                            Element fileEntryElement,
                            FileVersion fileVersion,
                            InputStream is,
                            String binPath,
                            String binPathName)
                     throws SystemException
Throws:
SystemException

exportPreview

protected void exportPreview(PortletDataContext portletDataContext,
                             FileEntry fileEntry,
                             Element fileEntryElement,
                             String binPathSuffix,
                             String previewType)
                      throws Exception
Throws:
Exception

exportPreview

protected void exportPreview(PortletDataContext portletDataContext,
                             FileEntry fileEntry,
                             Element fileEntryElement,
                             String binPathSuffix,
                             String previewType,
                             int fileIndex)
                      throws Exception
Throws:
Exception

exportThumbnail

protected void exportThumbnail(PortletDataContext portletDataContext,
                               FileEntry fileEntry,
                               Element fileEntryElement,
                               String binPathName,
                               int index)
                        throws PortalException,
                               SystemException
Throws:
PortalException
SystemException

exportThumbnails

protected void exportThumbnails(PortletDataContext portletDataContext,
                                FileEntry fileEntry,
                                Element fileEntryElement,
                                String binPathSuffix)
                         throws PortalException,
                                SystemException
Throws:
PortalException
SystemException

getBinPath

protected String getBinPath(PortletDataContext portletDataContext,
                            FileEntry fileEntry,
                            int index)

getBinPath

protected String getBinPath(PortletDataContext portletDataContext,
                            FileEntry fileEntry,
                            String type)

getFileVersionIds

protected abstract List<Long> getFileVersionIds()

getPreviewFilePath

protected String getPreviewFilePath(FileVersion fileVersion)

getPreviewFilePath

protected String getPreviewFilePath(FileVersion fileVersion,
                                    int index)

getPreviewFilePath

protected String getPreviewFilePath(FileVersion fileVersion,
                                    int index,
                                    String type)

getPreviewFilePath

protected String getPreviewFilePath(FileVersion fileVersion,
                                    String type)

getPreviewFilePath

protected String getPreviewFilePath(long groupId,
                                    long fileEntryId,
                                    long fileVersionId,
                                    int index,
                                    String type)

getPreviewFilePath

protected String getPreviewFilePath(long groupId,
                                    long fileEntryId,
                                    long fileVersionId,
                                    String type)

getPreviewTempFile

protected File getPreviewTempFile(String id)

getPreviewTempFile

protected File getPreviewTempFile(String id,
                                  int index)

getPreviewTempFile

protected File getPreviewTempFile(String id,
                                  int index,
                                  String type)

getPreviewTempFile

protected File getPreviewTempFile(String id,
                                  String type)

getPreviewTempFileCount

protected int getPreviewTempFileCount(FileVersion fileVersion)

getPreviewTempFileCount

protected int getPreviewTempFileCount(FileVersion fileVersion,
                                      String type)

getPreviewTempFilePath

protected String getPreviewTempFilePath(String id)

getPreviewTempFilePath

protected String getPreviewTempFilePath(String id,
                                        int index)

getPreviewTempFilePath

protected String getPreviewTempFilePath(String id,
                                        int index,
                                        String type)

getPreviewTempFilePath

protected String getPreviewTempFilePath(String id,
                                        String type)

getPreviewType

protected String getPreviewType()

getPreviewType

protected abstract String getPreviewType(FileVersion fileVersion)

getPreviewType

protected String getPreviewType(int index)

getPreviewTypes

protected String[] getPreviewTypes()

getThumbnailFilePath

protected String getThumbnailFilePath(FileVersion fileVersion,
                                      int index)

getThumbnailFilePath

protected String getThumbnailFilePath(FileVersion fileVersion,
                                      String type,
                                      int index)

getThumbnailFilePath

protected String getThumbnailFilePath(long groupId,
                                      long fileEntryId,
                                      long fileVersionId,
                                      String thumbnailType,
                                      int index)

getThumbnailTempFile

protected File getThumbnailTempFile(String id)

getThumbnailTempFile

protected File getThumbnailTempFile(String id,
                                    String type)

getThumbnailTempFilePath

protected String getThumbnailTempFilePath(String id)

getThumbnailTempFilePath

protected String getThumbnailTempFilePath(String id,
                                          String type)

getThumbnailType

protected String getThumbnailType()

getThumbnailType

protected abstract String getThumbnailType(FileVersion fileVersion)

hasPreview

protected boolean hasPreview(FileVersion fileVersion,
                             String type)
                      throws Exception
Throws:
Exception

hasPreviews

protected boolean hasPreviews(FileVersion fileVersion)
                       throws Exception
Throws:
Exception

hasThumbnail

protected boolean hasThumbnail(FileVersion fileVersion,
                               int index)

hasThumbnails

protected boolean hasThumbnails(FileVersion fileVersion)
                         throws SystemException
Throws:
SystemException

importPreview

protected void importPreview(PortletDataContext portletDataContext,
                             FileEntry fileEntry,
                             FileEntry importedFileEntry,
                             Element fileEntryElement,
                             String binPathSuffix,
                             String previewType)
                      throws Exception
Throws:
Exception

importPreview

protected void importPreview(PortletDataContext portletDataContext,
                             FileEntry fileEntry,
                             FileEntry importedFileEntry,
                             Element fileEntryElement,
                             String binPathSuffix,
                             String previewType,
                             int fileIndex)
                      throws Exception
Throws:
Exception

importPreviewFromLAR

protected void importPreviewFromLAR(PortletDataContext portletDataContext,
                                    FileEntry fileEntry,
                                    Element fileEntryElement,
                                    String binPathSuffix,
                                    String previewType,
                                    int fileIndex)
                             throws Exception
Throws:
Exception

importThumbnail

protected void importThumbnail(PortletDataContext portletDataContext,
                               FileEntry fileEntry,
                               FileEntry importedFileEntry,
                               Element fileEntryElement,
                               String binPathName,
                               int index)
                        throws Exception
Throws:
Exception

importThumbnailFromLAR

protected void importThumbnailFromLAR(PortletDataContext portletDataContext,
                                      FileEntry fileEntry,
                                      Element fileEntryElement,
                                      String binPathName,
                                      int index)
                               throws Exception
Throws:
Exception

importThumbnails

protected void importThumbnails(PortletDataContext portletDataContext,
                                FileEntry fileEntry,
                                FileEntry importedFileEntry,
                                Element fileEntryElement,
                                String binPathSuffix)
                         throws Exception
Throws:
Exception

isThumbnailEnabled

protected boolean isThumbnailEnabled(int index)
                              throws SystemException
Throws:
SystemException

sendGenerationMessage

protected void sendGenerationMessage(String destinationName,
                                     FileVersion sourceFileVersion,
                                     FileVersion destinationFileVersion)

storeThumbnailImage

protected void storeThumbnailImage(FileVersion fileVersion,
                                   RenderedImage renderedImage,
                                   int index)
                            throws Exception
Throws:
Exception

storeThumbnailImages

protected void storeThumbnailImages(FileVersion fileVersion,
                                    File file)
                             throws Exception
Throws:
Exception

storeThumbnailImages

protected void storeThumbnailImages(FileVersion fileVersion,
                                    RenderedImage renderedImage)
                             throws Exception
Throws:
Exception

Liferay 6.2-ce-ga5