Class MimetypeIconUpdater
java.lang.Object
org.nuxeo.ecm.platform.filemanager.core.listener.MimetypeIconUpdater
- All Implemented Interfaces:
EventListener
Listener responsible for computing the mimetype of a new or edited blob and the
common:icon
field if
necessary.
The logic of this event listener is divided into static public methods to make it easy to override this event listener with a custom implementation.
- Author:
- ogrisel
-
Field Summary
Modifier and TypeFieldDescriptionfinal BlobsExtractor
Deprecated, for removal: This API element is subject to removal in a future version.since 11.1.static final String
static final String
static final String
static final String
protected static final String
Deprecated, for removal: This API element is subject to removal in a future version.since 11.1. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionDeprecated, for removal: This API element is subject to removal in a future version.since 11.1.void
handleEvent
(Event event) Handle the given event.void
If the icon field is empty, initialize it to the document type iconvoid
updateBlobProperty
(DocumentModel doc, MimetypeRegistry mimetypeService, Property dirtyProperty) Updates the mimetype of a blob along with the icon and size fields of the document if the blob is the main blob of the document.void
updateIconField
(MimetypeEntry mimetypeEntry, DocumentModel doc) Computes the main icon of a Nuxeo document based on the mime type of the main attached blob with of fallback on the document type generic icon.
-
Field Details
-
ICON_SCHEMA
- See Also:
-
ICON_FIELD
- See Also:
-
MAIN_BLOB_FIELD
- See Also:
-
MAIN_BLOB_SCHEMA
- See Also:
-
OCTET_STREAM_MT
Deprecated, for removal: This API element is subject to removal in a future version.since 11.1. UseMimetypeRegistry.DEFAULT_MIMETYPE
instead.- See Also:
-
blobExtractor
Deprecated, for removal: This API element is subject to removal in a future version.since 11.1. Create a new instance ofBlobsExtractor
when needed.
-
-
Constructor Details
-
MimetypeIconUpdater
public MimetypeIconUpdater()
-
-
Method Details
-
getMimetypeRegistry
Deprecated, for removal: This API element is subject to removal in a future version.since 11.1. UseFramework.getService(Class)
withMimetypeRegistry
instead. -
handleEvent
Description copied from interface:EventListener
Handle the given event. The listener can cancel the event by callingEvent.cancel()
- Specified by:
handleEvent
in interfaceEventListener
- Parameters:
event
- the event
-
updateBlobProperty
public void updateBlobProperty(DocumentModel doc, MimetypeRegistry mimetypeService, Property dirtyProperty) Updates the mimetype of a blob along with the icon and size fields of the document if the blob is the main blob of the document. -
setDefaultIcon
If the icon field is empty, initialize it to the document type icon -
updateIconField
Computes the main icon of a Nuxeo document based on the mime type of the main attached blob with of fallback on the document type generic icon.
-