Class BinaryMetadataServiceImpl
- java.lang.Object
- 
- org.nuxeo.binary.metadata.internals.BinaryMetadataServiceImpl
 
- 
- All Implemented Interfaces:
- BinaryMetadataService
 
 public class BinaryMetadataServiceImpl extends Object implements BinaryMetadataService - Since:
- 7.1
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected BinaryMetadataComponentbinaryMetadataComponent
 - 
Constructor SummaryConstructors Modifier Constructor Description protectedBinaryMetadataServiceImpl(BinaryMetadataComponent binaryMetadataComponent)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidapplyUpdates(DocumentModel doc, List<MetadataMappingUpdate> mappingUpdates)Applies synchronously the givenmappingUpdatescomputed byBinaryMetadataService.getMetadataUpdates(DocumentModel, boolean)to the document.protected Set<MetadataRuleDescriptor>checkFilter(ActionContext actionContext)Check for each Binary Rule if the document is accepted or not.protected ActionContextcreateActionContext(DocumentModel doc)protected List<MetadataMappingDescriptor>getMapping(Collection<String> mappingDescriptorIds)List<MetadataMappingUpdate>getMetadataUpdates(DocumentModel doc, boolean creation)Returns the list ofMetadataMappingUpdateto apply to the document and the blob according to following rules: If creation, write metadata from Blob to doc. If Blob dirty and document metadata dirty, write metadata from doc to Blob. If Blob dirty and document metadata not dirty, write metadata from Blob to doc. If Blob not dirty and document metadata dirty, write metadata from doc to Blob. In all cases, the metadata is never written from doc to Blob ifMetadataMappingDescriptor#isReadOnly()returns true.protected BinaryMetadataProcessorgetProcessor(String processorId)List<MetadataMappingDescriptor>getSyncMapping(DocumentModel doc)Deprecated.since 2021.13, because only used byhandleSyncUpdate(DocumentModel)voidhandleSyncUpdate(DocumentModel doc)Deprecated.voidhandleUpdate(List<MetadataMappingDescriptor> mappingDescriptors, DocumentModel doc)Deprecated.protected booleanisDirtyMapping(MetadataMappingDescriptor mappingDescriptor, DocumentModel doc)Maps inspector only.Map<String,Object>readMetadata(String processorName, Blob blob, boolean ignorePrefix)Read and return metadata from a given binary with a given processor.Map<String,Object>readMetadata(String processorName, Blob blob, List<String> metadataNames, boolean ignorePrefix)Read and return metadata from a given binary and a given metadata list with a given processor.Map<String,Object>readMetadata(Blob blob, boolean ignorePrefix)Read and return metadata from a given binary with Nuxeo default processor.Map<String,Object>readMetadata(Blob blob, List<String> metadataNames, boolean ignorePrefix)Read and return metadata from a given binary and a given metadata list with Nuxeo default processor.BlobwriteMetadata(String processorName, Blob blob, String mappingDescriptorId, DocumentModel doc)Write given metadata mapping id into a given binary with a Nuxeo default processor.BlobwriteMetadata(String processorName, Blob blob, Map<String,Object> metadata, boolean ignorePrefix)Write given metadata into a given binary with a given processor.BlobwriteMetadata(Blob blob, String mappingDescriptorId, DocumentModel doc)Write given metadata mapping id into a given binary with a Nuxeo default processor.BlobwriteMetadata(Blob blob, Map<String,Object> metadata, boolean ignorePrefix)Write given metadata into a given binary with a Nuxeo default processor.voidwriteMetadata(DocumentModel doc)Write metadata (from a binary) into a given Nuxeo Document according to the metadata mapping and rules contributions.voidwriteMetadata(DocumentModel doc, String mappingDescriptorId)Apply metadata mapping and override document properties according to the contribution.voidwriteMetadata(DocumentModel doc, MetadataMappingDescriptor mappingDescriptor)
 
- 
- 
- 
Field Detail- 
binaryMetadataComponentprotected BinaryMetadataComponent binaryMetadataComponent 
 
- 
 - 
Constructor Detail- 
BinaryMetadataServiceImplprotected BinaryMetadataServiceImpl(BinaryMetadataComponent binaryMetadataComponent) 
 
- 
 - 
Method Detail- 
readMetadatapublic Map<String,Object> readMetadata(String processorName, Blob blob, List<String> metadataNames, boolean ignorePrefix) Description copied from interface:BinaryMetadataServiceRead and return metadata from a given binary and a given metadata list with a given processor.- Specified by:
- readMetadatain interface- BinaryMetadataService
- Parameters:
- processorName- Name of the contributed processor to run.
- blob- Binary which metadata are read.
- metadataNames- Metadata list to extract from the binary.
- ignorePrefix- Since 7.3
- Returns:
- Extracted metadata.
 
 - 
readMetadatapublic Map<String,Object> readMetadata(Blob blob, List<String> metadataNames, boolean ignorePrefix) Description copied from interface:BinaryMetadataServiceRead and return metadata from a given binary and a given metadata list with Nuxeo default processor.- Specified by:
- readMetadatain interface- BinaryMetadataService
- Parameters:
- blob- Binary which metadata are read.
- metadataNames- Metadata list to extract from the binary.
- ignorePrefix- Since 7.3
- Returns:
- Extracted metadata.
 
 - 
readMetadatapublic Map<String,Object> readMetadata(Blob blob, boolean ignorePrefix) Description copied from interface:BinaryMetadataServiceRead and return metadata from a given binary with Nuxeo default processor.- Specified by:
- readMetadatain interface- BinaryMetadataService
- Parameters:
- blob- Binary which metadata are read.
- ignorePrefix- Since 7.3
- Returns:
- Extracted metadata.
 
 - 
readMetadatapublic Map<String,Object> readMetadata(String processorName, Blob blob, boolean ignorePrefix) Description copied from interface:BinaryMetadataServiceRead and return metadata from a given binary with a given processor.- Specified by:
- readMetadatain interface- BinaryMetadataService
- Parameters:
- processorName- Name of the contributed processor to run.
- blob- Binary which metadata are read.
- ignorePrefix- Since 7.3
- Returns:
- Extracted metadata.
 
 - 
writeMetadatapublic Blob writeMetadata(String processorName, Blob blob, Map<String,Object> metadata, boolean ignorePrefix) Description copied from interface:BinaryMetadataServiceWrite given metadata into a given binary with a given processor.- Specified by:
- writeMetadatain interface- BinaryMetadataService
- Parameters:
- processorName- Name of the contributed processor to run.
- blob- Binary which metadata are written.
- metadata- Injected metadata.
- ignorePrefix- Since 7.3
- Returns:
- the updated blob, or nullif there was an error (since 7.4)
 
 - 
writeMetadatapublic Blob writeMetadata(Blob blob, Map<String,Object> metadata, boolean ignorePrefix) Description copied from interface:BinaryMetadataServiceWrite given metadata into a given binary with a Nuxeo default processor.- Specified by:
- writeMetadatain interface- BinaryMetadataService
- Parameters:
- blob- Binary which metadata are written.
- metadata- Injected metadata.
- ignorePrefix- Since 7.3
- Returns:
- the updated blob, or nullif there was an error (since 7.4)
 
 - 
writeMetadatapublic Blob writeMetadata(String processorName, Blob blob, String mappingDescriptorId, DocumentModel doc) Description copied from interface:BinaryMetadataServiceWrite given metadata mapping id into a given binary with a Nuxeo default processor.- Specified by:
- writeMetadatain interface- BinaryMetadataService
- Parameters:
- processorName- Name of the contributed processor to run.
- blob- Binary which metadata are written.
- mappingDescriptorId- The metadata mapping to apply on the document.
- doc- Document from properties will be read.
- Returns:
- the updated blob, or nullif there was an error (since 7.4)
 
 - 
writeMetadatapublic Blob writeMetadata(Blob blob, String mappingDescriptorId, DocumentModel doc) Description copied from interface:BinaryMetadataServiceWrite given metadata mapping id into a given binary with a Nuxeo default processor.- Specified by:
- writeMetadatain interface- BinaryMetadataService
- Parameters:
- blob- Binary which metadata are written.
- mappingDescriptorId- The metadata mapping to apply on the document.
- doc- Document from properties will be read.
- Returns:
- the updated blob, or nullif there was an error (since 7.4)
 
 - 
writeMetadatapublic void writeMetadata(DocumentModel doc) Description copied from interface:BinaryMetadataServiceWrite metadata (from a binary) into a given Nuxeo Document according to the metadata mapping and rules contributions.The document is not saved in the session, it's up to the caller to deal with this. - Specified by:
- writeMetadatain interface- BinaryMetadataService
- Parameters:
- doc- Nuxeo Document which metadata are written.
 
 - 
writeMetadatapublic void writeMetadata(DocumentModel doc, String mappingDescriptorId) Description copied from interface:BinaryMetadataServiceApply metadata mapping and override document properties according to the contribution.The document is not saved in the session, it's up to the caller to deal with this. - Specified by:
- writeMetadatain interface- BinaryMetadataService
- Parameters:
- doc- The input document.
- mappingDescriptorId- The metadata mapping to apply on the document.
 
 - 
writeMetadatapublic void writeMetadata(DocumentModel doc, MetadataMappingDescriptor mappingDescriptor) 
 - 
getMetadataUpdatespublic List<MetadataMappingUpdate> getMetadataUpdates(DocumentModel doc, boolean creation) Description copied from interface:BinaryMetadataServiceReturns the list ofMetadataMappingUpdateto apply to the document and the blob according to following rules:- If creation, write metadata from Blob to doc.
- If Blob dirty and document metadata dirty, write metadata from doc to Blob.
- If Blob dirty and document metadata not dirty, write metadata from Blob to doc.
- If Blob not dirty and document metadata dirty, write metadata from doc to Blob.
 MetadataMappingDescriptor#isReadOnly()returns true.- Specified by:
- getMetadataUpdatesin interface- BinaryMetadataService
 
 - 
applyUpdatespublic void applyUpdates(DocumentModel doc, List<MetadataMappingUpdate> mappingUpdates) Description copied from interface:BinaryMetadataServiceApplies synchronously the givenmappingUpdatescomputed byBinaryMetadataService.getMetadataUpdates(DocumentModel, boolean)to the document.The document is not saved in the session, it's up to the caller to deal with this. Note: This is potentially a long processing. - Specified by:
- applyUpdatesin interface- BinaryMetadataService
 
 - 
handleSyncUpdate@Deprecated public void handleSyncUpdate(DocumentModel doc) Deprecated.Description copied from interface:BinaryMetadataServiceHandle document and blob updates according to following rules in an event context:- Define if rule should be executed in async or sync mode.
- If Blob dirty and document metadata dirty, write metadata from doc to Blob.
- If Blob dirty and document metadata not dirty, write metadata from Blob to doc.
- If Blob not dirty and document metadata dirty, write metadata from doc to Blob.
 MetadataMappingDescriptor#isReadOnly()returns true.The document is not saved in the session, it's up to the caller to deal with this. - Specified by:
- handleSyncUpdatein interface- BinaryMetadataService
 
 - 
handleUpdate@Deprecated public void handleUpdate(List<MetadataMappingDescriptor> mappingDescriptors, DocumentModel doc) Deprecated.Description copied from interface:BinaryMetadataServiceHandle document and blob updates according to following rules in an event context:- Define if rule should be executed in async or sync mode.
- If Blob dirty and document metadata dirty, write metadata from doc to Blob.
- If Blob dirty and document metadata not dirty, write metadata from Blob to doc.
- If Blob not dirty and document metadata dirty, write metadata from doc to Blob.
 MetadataMappingDescriptor#isReadOnly()returns true.The document is not saved in the session, it's up to the caller to deal with this. - Specified by:
- handleUpdatein interface- BinaryMetadataService
 
 - 
checkFilterprotected Set<MetadataRuleDescriptor> checkFilter(ActionContext actionContext) Check for each Binary Rule if the document is accepted or not.- Returns:
- the list of metadata which should be processed sorted by rules order. (high to low priority)
 
 - 
createActionContextprotected ActionContext createActionContext(DocumentModel doc) 
 - 
getProcessorprotected BinaryMetadataProcessor getProcessor(String processorId) throws NoSuchMethodException - Throws:
- NoSuchMethodException
 
 - 
getSyncMapping@Deprecated public List<MetadataMappingDescriptor> getSyncMapping(DocumentModel doc) Deprecated.since 2021.13, because only used byhandleSyncUpdate(DocumentModel)- Returns:
- Dirty metadata from metadata mapping contribution and handle async processes.
 
 - 
getMappingprotected List<MetadataMappingDescriptor> getMapping(Collection<String> mappingDescriptorIds) 
 - 
isDirtyMappingprotected boolean isDirtyMapping(MetadataMappingDescriptor mappingDescriptor, DocumentModel doc) Maps inspector only.
 
- 
 
-