public class MimetypeIconUpdater extends Object implements EventListener
The common:size is also maintained as the length of the main blob to preserve backward compatibility.
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.
Modifier and Type | Field and Description |
---|---|
BlobsExtractor |
blobExtractor |
static String |
ICON_FIELD |
static String |
ICON_SCHEMA |
protected org.apache.commons.logging.Log |
log |
static String |
MAIN_BLOB_FIELD |
static String |
MAIN_BLOB_SCHEMA |
static String |
MAIN_EXTERNAL_FILENAME_FIELD
Deprecated.
|
protected static String |
OCTET_STREAM_MT |
Constructor and Description |
---|
MimetypeIconUpdater() |
Modifier and Type | Method and Description |
---|---|
MimetypeRegistry |
getMimetypeRegistry() |
void |
handleEvent(Event event)
Handle the given event.
|
void |
recursivelyUpdateBlobs(DocumentModel doc,
MimetypeRegistry mimetypeService,
Iterator<Property> dirtyChildren)
Deprecated.
now we use
BlobsExtractor that cache path fields. |
void |
setDefaultIcon(DocumentModel doc)
If the icon field is empty, initialize it to the document type icon
|
void |
updateBlobProperty(DocumentModel doc,
MimetypeRegistry mimetypeService,
Property dirtyProperty)
Update 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 |
updateFilename(DocumentModel doc)
Backward compatibility for external filename field: if edited, it might affect the main blob mimetype
|
void |
updateIconField(MimetypeEntry mimetypeEntry,
DocumentModel doc)
Compute the main icon of a Nuxeo document based on the mimetype of the main attached blob with of fallback on the
document type generic icon.
|
protected org.apache.commons.logging.Log log
public static final String ICON_SCHEMA
public static final String ICON_FIELD
public static final String MAIN_BLOB_FIELD
public static final String MAIN_BLOB_SCHEMA
@Deprecated public static final String MAIN_EXTERNAL_FILENAME_FIELD
protected static final String OCTET_STREAM_MT
public final BlobsExtractor blobExtractor
public MimetypeIconUpdater()
public MimetypeRegistry getMimetypeRegistry()
public void handleEvent(Event event)
EventListener
Event.cancel()
handleEvent
in interface EventListener
event
- the event@Deprecated public void recursivelyUpdateBlobs(DocumentModel doc, MimetypeRegistry mimetypeService, Iterator<Property> dirtyChildren)
BlobsExtractor
that cache path fields.public void updateBlobProperty(DocumentModel doc, MimetypeRegistry mimetypeService, Property dirtyProperty)
public void updateFilename(DocumentModel doc) throws PropertyException
PropertyException
public void setDefaultIcon(DocumentModel doc)
public void updateIconField(MimetypeEntry mimetypeEntry, DocumentModel doc)
Copyright © 2015 Nuxeo SA. All rights reserved.