Class MimetypeIconUpdater
- java.lang.Object
-
- org.nuxeo.ecm.platform.filemanager.core.listener.MimetypeIconUpdater
-
- All Implemented Interfaces:
EventListener
public class MimetypeIconUpdater extends Object implements EventListener
Listener responsible for computing the mimetype of a new or edited blob and thecommon: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
Fields Modifier and Type Field Description BlobsExtractor
blobExtractor
Deprecated, for removal: This API element is subject to removal in a future version.since 11.1.static String
ICON_FIELD
static String
ICON_SCHEMA
protected Log
log
static String
MAIN_BLOB_FIELD
static String
MAIN_BLOB_SCHEMA
protected static String
OCTET_STREAM_MT
Deprecated, for removal: This API element is subject to removal in a future version.since 11.1.
-
Constructor Summary
Constructors Constructor Description MimetypeIconUpdater()
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description MimetypeRegistry
getMimetypeRegistry()
Deprecated, 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
setDefaultIcon(DocumentModel doc)
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 Detail
-
ICON_SCHEMA
public static final String ICON_SCHEMA
- See Also:
- Constant Field Values
-
ICON_FIELD
public static final String ICON_FIELD
- See Also:
- Constant Field Values
-
MAIN_BLOB_FIELD
public static final String MAIN_BLOB_FIELD
- See Also:
- Constant Field Values
-
MAIN_BLOB_SCHEMA
public static final String MAIN_BLOB_SCHEMA
- See Also:
- Constant Field Values
-
OCTET_STREAM_MT
@Deprecated(since="11.1", forRemoval=true) protected static final String 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:
- Constant Field Values
-
blobExtractor
@Deprecated(since="11.1", forRemoval=true) public final BlobsExtractor 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 Detail
-
MimetypeIconUpdater
public MimetypeIconUpdater()
-
-
Method Detail
-
getMimetypeRegistry
@Deprecated(since="11.1", forRemoval=true) public MimetypeRegistry getMimetypeRegistry()
Deprecated, for removal: This API element is subject to removal in a future version.since 11.1. UseFramework.getService(Class)
withMimetypeRegistry
instead.
-
handleEvent
public void handleEvent(Event event)
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
public void setDefaultIcon(DocumentModel doc)
If the icon field is empty, initialize it to the document type icon
-
updateIconField
public 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.
-
-