AbstractMetadataExtractor Base Class - Alfresco Content Services - 23.4 - 23.4 - Ready - Alfresco - external

Alfresco Content Services

Platform
Alfresco
Product
Alfresco Content Services
Release
23.4
License

The AbstractMetadataExtractor may be extended to perform metadata extract and embed tasks, by overriding two methods in the sub classes:

publicabstract Map<String, Serializable> extractMetadata(String sourceMimetype, Map<String, String> transformOptions,
                                                              File sourceFile)throws Exception;

    publicvoidembedMetadata(String sourceMimetype, String targetMimetype, Map<String, String> transformOptions,
                              File sourceFile, File targetFile) throws Exception
    {
        // Default nothing, as embedding is not supported in most cases
    }

Method parameters:

  • sourceMimetype mimetype of the source
  • transformOptions transform options from the client
  • sourceFile the source as a file

The extractMetadata should extract and return ALL available metadata from the sourceFile. These values are then mapped into content repository property names and values, depending on what is defined in a <classname>_metadata_extract.properties file. Value may be discarded or a single value may even be used for multiple properties. The selected values are sent back to the repository as JSON as a mapping of fully qualified content model property names to values, where the values are applied to the source node.