Class BinaryMetadataServiceImpl
java.lang.Object
org.nuxeo.binary.metadata.internals.BinaryMetadataServiceImpl
- All Implemented Interfaces:
BinaryMetadataService
- Since:
- 7.1
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
BinaryMetadataServiceImpl
(BinaryMetadataComponent binaryMetadataComponent) -
Method Summary
Modifier and TypeMethodDescriptionvoid
applyUpdates
(DocumentModel doc, List<MetadataMappingUpdate> mappingUpdates) Applies synchronously the givenmappingUpdates
computed 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 ActionContext
protected List<MetadataMappingDescriptor>
getMapping
(Collection<String> mappingDescriptorIds) getMetadataUpdates
(DocumentModel doc, boolean creation) Returns the list ofMetadataMappingUpdate
to 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 BinaryMetadataProcessor
getProcessor
(String processorId) Deprecated.void
Deprecated.void
handleUpdate
(List<MetadataMappingDescriptor> mappingDescriptors, DocumentModel doc) Deprecated.protected boolean
isDirtyMapping
(MetadataMappingDescriptor mappingDescriptor, DocumentModel doc) Maps inspector only.readMetadata
(String processorName, Blob blob, boolean ignorePrefix) Read and return metadata from a given binary with a given processor.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.readMetadata
(Blob blob, boolean ignorePrefix) Read and return metadata from a given binary with Nuxeo default processor.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.writeMetadata
(String processorName, Blob blob, String mappingDescriptorId, DocumentModel doc) Write given metadata mapping id into a given binary with a Nuxeo default processor.Write given metadata into a given binary with a given processor.writeMetadata
(Blob blob, String mappingDescriptorId, DocumentModel doc) Write given metadata mapping id into a given binary with a Nuxeo default processor.writeMetadata
(Blob blob, Map<String, Object> metadata, boolean ignorePrefix) Write given metadata into a given binary with a Nuxeo default processor.void
Write metadata (from a binary) into a given Nuxeo Document according to the metadata mapping and rules contributions.void
writeMetadata
(DocumentModel doc, String mappingDescriptorId) Apply metadata mapping and override document properties according to the contribution.void
writeMetadata
(DocumentModel doc, MetadataMappingDescriptor mappingDescriptor)
-
Field Details
-
binaryMetadataComponent
-
-
Constructor Details
-
BinaryMetadataServiceImpl
-
-
Method Details
-
readMetadata
public Map<String,Object> readMetadata(String processorName, Blob blob, List<String> metadataNames, boolean ignorePrefix) Description copied from interface:BinaryMetadataService
Read and return metadata from a given binary and a given metadata list with a given processor.- Specified by:
readMetadata
in interfaceBinaryMetadataService
- 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.
-
readMetadata
Description copied from interface:BinaryMetadataService
Read and return metadata from a given binary and a given metadata list with Nuxeo default processor.- Specified by:
readMetadata
in interfaceBinaryMetadataService
- Parameters:
blob
- Binary which metadata are read.metadataNames
- Metadata list to extract from the binary.ignorePrefix
- Since 7.3- Returns:
- Extracted metadata.
-
readMetadata
Description copied from interface:BinaryMetadataService
Read and return metadata from a given binary with Nuxeo default processor.- Specified by:
readMetadata
in interfaceBinaryMetadataService
- Parameters:
blob
- Binary which metadata are read.ignorePrefix
- Since 7.3- Returns:
- Extracted metadata.
-
readMetadata
Description copied from interface:BinaryMetadataService
Read and return metadata from a given binary with a given processor.- Specified by:
readMetadata
in interfaceBinaryMetadataService
- Parameters:
processorName
- Name of the contributed processor to run.blob
- Binary which metadata are read.ignorePrefix
- Since 7.3- Returns:
- Extracted metadata.
-
writeMetadata
public Blob writeMetadata(String processorName, Blob blob, Map<String, Object> metadata, boolean ignorePrefix) Description copied from interface:BinaryMetadataService
Write given metadata into a given binary with a given processor.- Specified by:
writeMetadata
in interfaceBinaryMetadataService
- 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
null
if there was an error (since 7.4)
-
writeMetadata
Description copied from interface:BinaryMetadataService
Write given metadata into a given binary with a Nuxeo default processor.- Specified by:
writeMetadata
in interfaceBinaryMetadataService
- Parameters:
blob
- Binary which metadata are written.metadata
- Injected metadata.ignorePrefix
- Since 7.3- Returns:
- the updated blob, or
null
if there was an error (since 7.4)
-
writeMetadata
public Blob writeMetadata(String processorName, Blob blob, String mappingDescriptorId, DocumentModel doc) Description copied from interface:BinaryMetadataService
Write given metadata mapping id into a given binary with a Nuxeo default processor.- Specified by:
writeMetadata
in interfaceBinaryMetadataService
- 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
null
if there was an error (since 7.4)
-
writeMetadata
Description copied from interface:BinaryMetadataService
Write given metadata mapping id into a given binary with a Nuxeo default processor.- Specified by:
writeMetadata
in interfaceBinaryMetadataService
- 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
null
if there was an error (since 7.4)
-
writeMetadata
Description copied from interface:BinaryMetadataService
Write 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:
writeMetadata
in interfaceBinaryMetadataService
- Parameters:
doc
- Nuxeo Document which metadata are written.
-
writeMetadata
Description copied from interface:BinaryMetadataService
Apply 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:
writeMetadata
in interfaceBinaryMetadataService
- Parameters:
doc
- The input document.mappingDescriptorId
- The metadata mapping to apply on the document.
-
writeMetadata
-
getMetadataUpdates
Description copied from interface:BinaryMetadataService
Returns the list ofMetadataMappingUpdate
to 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:
getMetadataUpdates
in interfaceBinaryMetadataService
-
applyUpdates
Description copied from interface:BinaryMetadataService
Applies synchronously the givenmappingUpdates
computed 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:
applyUpdates
in interfaceBinaryMetadataService
-
handleSyncUpdate
Deprecated.Description copied from interface:BinaryMetadataService
Handle 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:
handleSyncUpdate
in interfaceBinaryMetadataService
-
handleUpdate
@Deprecated public void handleUpdate(List<MetadataMappingDescriptor> mappingDescriptors, DocumentModel doc) Deprecated.Description copied from interface:BinaryMetadataService
Handle 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:
handleUpdate
in interfaceBinaryMetadataService
-
checkFilter
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)
-
createActionContext
-
getProcessor
- Throws:
NoSuchMethodException
-
getSyncMapping
Deprecated.since 2021.13, because only used byhandleSyncUpdate(DocumentModel)
- Returns:
- Dirty metadata from metadata mapping contribution and handle async processes.
-
getMapping
-
isDirtyMapping
Maps inspector only.
-
handleSyncUpdate(DocumentModel)