Liferay 7.0-ce-b4

com.liferay.portlet.documentlibrary.util
Class RawMetadataProcessorImpl

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

public class RawMetadataProcessorImpl
extends Object
implements DLProcessor, RawMetadataProcessor


Constructor Summary
RawMetadataProcessorImpl()
           
 
Method Summary
 void afterPropertiesSet()
           
 void cleanUp(FileEntry fileEntry)
          Cleans up any resources that the processor created for the file entry.
 void cleanUp(FileVersion fileVersion)
          Cleans up any resources that the processor created for the given file version.
 void copy(FileVersion sourceFileVersion, FileVersion destinationFileVersion)
          Copies all resources generated for the source file version, reusing them for destination file version.
 void exportGeneratedFiles(PortletDataContext portletDataContext, FileEntry fileEntry, Element fileEntryElement)
          Exports any resources generated for the file entry into file entry element.
 void generateMetadata(FileVersion fileVersion)
          Generates the raw metadata associated with the file entry.
 String getType()
          Returns the processor's type.
 void importGeneratedFiles(PortletDataContext portletDataContext, FileEntry fileEntry, FileEntry importedFileEntry, Element fileEntryElement)
          Imports any existing resources from the file entry or file entry element.
 boolean isSupported(FileVersion fileVersion)
          Returns true if the file version is supported by this processor.
 boolean isSupported(String mimeType)
          Returns true if the given file MIME type is supported by this processor.
 void saveMetadata(FileVersion fileVersion)
          Saves the raw metadata present in the file version.
 void trigger(FileVersion fileVersion)
          Launches extraction of raw metadata from the file version.
 void trigger(FileVersion sourceFileVersion, FileVersion destinationFileVersion)
          Launches the processor's work with respect to the destination file version.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RawMetadataProcessorImpl

public RawMetadataProcessorImpl()
Method Detail

afterPropertiesSet

public void afterPropertiesSet()
Specified by:
afterPropertiesSet in interface DLProcessor

cleanUp

public void cleanUp(FileEntry fileEntry)
Description copied from interface: DLProcessor
Cleans up any resources that the processor created for the file entry. Note that all resources for all file versions of this file entry are permanently deleted.

Specified by:
cleanUp in interface DLProcessor
Specified by:
cleanUp in interface RawMetadataProcessor
Parameters:
fileEntry - the file entry for which resources are cleaned up

cleanUp

public void cleanUp(FileVersion fileVersion)
Description copied from interface: DLProcessor
Cleans up any resources that the processor created for the given file version. Note that other resources associated with other file versions for the same file entry aren't affected; use DLProcessor.cleanUp(FileEntry) if you want to clean up everything.

Specified by:
cleanUp in interface DLProcessor
Specified by:
cleanUp in interface RawMetadataProcessor
Parameters:
fileVersion - the file version for which resources will be cleaned up

copy

public void copy(FileVersion sourceFileVersion,
                 FileVersion destinationFileVersion)
Description copied from interface: DLProcessor
Copies all resources generated for the source file version, reusing them for destination file version. Note that resources are literally copied, making the resulting resources independent (i.e., if afterwards the source file version is deleted, the destination file version resources aren't affected).

Specified by:
copy in interface DLProcessor
Parameters:
sourceFileVersion - the file version to copy resources from
destinationFileVersion - the file version to copy resources to

exportGeneratedFiles

public void exportGeneratedFiles(PortletDataContext portletDataContext,
                                 FileEntry fileEntry,
                                 Element fileEntryElement)
Description copied from interface: DLProcessor
Exports any resources generated for the file entry into file entry element.

Specified by:
exportGeneratedFiles in interface DLProcessor
Parameters:
portletDataContext - the portlet data context to use during this export operation
fileEntry - the file entry for which resources are exported
fileEntryElement - the file entry element to save resources into

generateMetadata

public void generateMetadata(FileVersion fileVersion)
Description copied from interface: RawMetadataProcessor
Generates the raw metadata associated with the file entry.

Specified by:
generateMetadata in interface RawMetadataProcessor
Parameters:
fileVersion - the file version from which the raw metatada is to be generated

getType

public String getType()
Description copied from interface: DLProcessor
Returns the processor's type. See DLProcessorConstants for the set of predefined processor types.

Specified by:
getType in interface DLProcessor
Returns:
the type of this processor

importGeneratedFiles

public void importGeneratedFiles(PortletDataContext portletDataContext,
                                 FileEntry fileEntry,
                                 FileEntry importedFileEntry,
                                 Element fileEntryElement)
Description copied from interface: DLProcessor
Imports any existing resources from the file entry or file entry element. If the portlet data context supports direct binary import (see PortletDataContext.isPerformDirectBinaryImport()), the resources are directly copied from the file entry; otherwise, they're extracted from the file entry element.

Specified by:
importGeneratedFiles in interface DLProcessor
Parameters:
portletDataContext - the portlet data context to use during this import operation
fileEntry - the file entry to import resources from, if direct binary import is supported
importedFileEntry - the file entry for which resources are imported
fileEntryElement - the file entry element to import resources from, if direct binary import is not supported

isSupported

public boolean isSupported(FileVersion fileVersion)
Description copied from interface: DLProcessor
Returns true if the file version is supported by this processor.

Specified by:
isSupported in interface DLProcessor
Specified by:
isSupported in interface RawMetadataProcessor
Parameters:
fileVersion - the file version
Returns:
true if this processor supports the file version; false otherwise

isSupported

public boolean isSupported(String mimeType)
Description copied from interface: DLProcessor
Returns true if the given file MIME type is supported by this processor.

Specified by:
isSupported in interface DLProcessor
Specified by:
isSupported in interface RawMetadataProcessor
Parameters:
mimeType - the MIME type
Returns:
true if this processor supports the MIME type; false otherwise

saveMetadata

public void saveMetadata(FileVersion fileVersion)
                  throws PortalException
Description copied from interface: RawMetadataProcessor
Saves the raw metadata present in the file version.

The raw metadata present in the file version is extracted and persisted using TikaRawMetadataProcessor.

Specified by:
saveMetadata in interface RawMetadataProcessor
Parameters:
fileVersion - the file version from which the raw metatada is to be extracted and persisted
Throws:
PortalException

trigger

public void trigger(FileVersion fileVersion)
Description copied from interface: RawMetadataProcessor
Launches extraction of raw metadata from the file version.

The raw metadata extraction is done asynchronously.

Specified by:
trigger in interface RawMetadataProcessor
Parameters:
fileVersion - the latest file version from which the raw metadata is to be generated

trigger

public void trigger(FileVersion sourceFileVersion,
                    FileVersion destinationFileVersion)
Description copied from interface: DLProcessor
Launches the processor's work with respect to the destination 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

Liferay 7.0-ce-b4