Package org.nuxeo.binary.metadata.api
Interface BinaryMetadataService
- All Known Implementing Classes:
BinaryMetadataServiceImpl
public interface BinaryMetadataService
Read/Write binary metadata services.
- Since:
- 7.1
-
Method Summary
Modifier and TypeMethodDescriptionvoid
applyUpdates
(DocumentModel doc, List<MetadataMappingUpdate> mappingUpdates) Applies synchronously the givenmappingUpdates
computed bygetMetadataUpdates(DocumentModel, boolean)
to the document.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.void
Deprecated.void
handleUpdate
(List<MetadataMappingDescriptor> syncMappingDescriptors, DocumentModel doc) Deprecated.since 2021.13, the listener and work now usegetMetadataUpdates(DocumentModel, boolean)
andapplyUpdates(DocumentModel, List)
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.
-
Method Details
-
readMetadata
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.- 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
Read and return metadata from a given binary and a given metadata list with Nuxeo default processor.- Parameters:
blob
- Binary which metadata are read.metadataNames
- Metadata list to extract from the binary.ignorePrefix
- Since 7.3- Returns:
- Extracted metadata.
-
readMetadata
Read and return metadata from a given binary with Nuxeo default processor.- Parameters:
blob
- Binary which metadata are read.ignorePrefix
- Since 7.3- Returns:
- Extracted metadata.
-
readMetadata
Read and return metadata from a given binary with a given processor.- Parameters:
processorName
- Name of the contributed processor to run.blob
- Binary which metadata are read.ignorePrefix
- Since 7.3- Returns:
- Extracted metadata.
-
writeMetadata
Blob writeMetadata(String processorName, Blob blob, Map<String, Object> metadata, boolean ignorePrefix) Write given metadata into a given binary with a given processor.- 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
Write given metadata into a given binary with a Nuxeo default processor.- 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
Write given metadata mapping id into a given binary with a Nuxeo default processor.- 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
Write given metadata mapping id into a given binary with a Nuxeo default processor.- 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
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.
- Parameters:
doc
- Nuxeo Document which metadata are written.
-
writeMetadata
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.
- Parameters:
doc
- The input document.mappingDescriptorId
- The metadata mapping to apply on the document.
-
getMetadataUpdates
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.- Since:
- 2021.13
-
applyUpdates
Applies synchronously the givenmappingUpdates
computed bygetMetadataUpdates(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.
- Since:
- 2021.13
-
handleUpdate
@Deprecated(since="2021.13") void handleUpdate(List<MetadataMappingDescriptor> syncMappingDescriptors, DocumentModel doc) Deprecated.since 2021.13, the listener and work now usegetMetadataUpdates(DocumentModel, boolean)
andapplyUpdates(DocumentModel, List)
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.
-
handleSyncUpdate
Deprecated.since 2021.13, the listener now usesgetMetadataUpdates(DocumentModel, boolean)
andapplyUpdates(DocumentModel, List)
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.
-
getMetadataUpdates(DocumentModel, boolean)
andapplyUpdates(DocumentModel, List)