Class AbstractFileImporter
java.lang.Object
org.nuxeo.ecm.platform.filemanager.service.extension.AbstractFileImporter
- All Implemented Interfaces:
Serializable
,Comparable<FileImporter>
,FileImporter
- Direct Known Subclasses:
AudioImporter
,CSVZipImporter
,DefaultFileImporter
,ExportedZipImporter
,ImagePlugin
,NoteImporter
,ThreeDImporter
,VideoImporter
File importer abstract class.
Default file importer behavior.
- Author:
- Andreas Kalogeropolos
- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Deprecated.protected String
protected boolean
protected FileManagerService
Deprecated.since 10.3, useFramework.getService(Class)
instead if neededprotected String
protected Integer
static final String
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
checkAllowedSubtypes
(CoreSession session, String path, String typeName) protected void
checkSecurity
(CoreSession session, String path) int
compareTo
(FileImporter other) create
(CoreSession session, Blob content, String path, boolean overwrite, String fullname, TypeManager typeService) Creates the document.protected void
createDocument
(DocumentModel doc, String title) Creates the document (sets its properties).createOrUpdate
(FileImporterContext context) Returns a created or updated document based on the givencontext
.protected void
doSecurityCheck
(CoreSession documentManager, String path, String typeName) Deprecated.since 11.3, useand #checkAllowedSubtypes(CoreSession, String, String)
insteadprotected void
doSecurityCheck
(CoreSession documentManager, String path, String typeName, TypeManager typeService) Deprecated.since 11.3, useand #checkAllowedSubtypes(CoreSession, String, String)
insteadprotected Blob
getBlob
(DocumentModel doc) protected String
Default document type to use when the plugin XML configuration does not specify one.Returns the document type configured for thisFileImporter
,null
if no document type is configured.protected String
getDocType
(DocumentModel container) Gets the doc type to use in the given container.Deprecated.since 10.3, useFramework.getService(Class)
instead if neededGets filters.getName()
Gets the plugin name.protected String
getNearestContainerPath
(CoreSession documentManager, String path) Returns nearest container pathgetOrder()
Returns the plugin order for sorting.boolean
boolean
Returnstrue
ifFileImporter.createOrUpdate(FileImporterContext)
creates more than one document for the given blob,false
otherwise.protected boolean
Whether document overwrite is detected by checking title or filename.boolean
Tests whether plugin is suitable for the given mimetype.void
setDocType
(String docType) Sets the document type configured for this importer.void
setEnabled
(boolean enabled) void
setFileManagerService
(FileManagerService fileManagerService) Deprecated.since 10.3, useFramework.getService(Class)
instead if neededvoid
setFilters
(List<String> filters) Sets filters.void
Sets plugin name.void
Sets the plugin order for sorting.protected void
updateDocument
(DocumentModel doc, Blob content) Updates the document (sets its properties).protected boolean
updateDocumentIfPossible
(DocumentModel doc, Blob content) Tries to update the documentdoc
with the blobcontent
.
-
Field Details
-
name
-
docType
-
filters
-
patterns
-
enabled
protected boolean enabled -
order
-
SKIP_UPDATE_AUDIT_LOGGING
- See Also:
-
DISABLE_AUDIT_LOGGER
Deprecated.since 2021.34, useCoreSession.DISABLE_AUDIT_LOGGER
insteadOriginally duplicated from NXAuditEventsService.DISABLE_AUDIT_LOGGER to avoid circular dependency.- See Also:
-
fileManagerService
Deprecated.since 10.3, useFramework.getService(Class)
instead if needed
-
-
Constructor Details
-
AbstractFileImporter
protected AbstractFileImporter()
-
-
Method Details
-
getFilters
Description copied from interface:FileImporter
Gets filters.The filters are all the mime/type this plugin can deal with.
- Specified by:
getFilters
in interfaceFileImporter
- Returns:
- list of string holding each filters.
-
setFilters
Description copied from interface:FileImporter
Sets filters.The filters are all the mime/types this plugin can deal with.
- Specified by:
setFilters
in interfaceFileImporter
- Parameters:
filters
- a list of strings representing each filter
-
matches
Description copied from interface:FileImporter
Tests whether plugin is suitable for the given mimetype.- Specified by:
matches
in interfaceFileImporter
- Parameters:
mimeType
- the mimetype to test
-
getName
Description copied from interface:FileImporter
Gets the plugin name.- Specified by:
getName
in interfaceFileImporter
- Returns:
- a string holding the plugin name
-
setName
Description copied from interface:FileImporter
Sets plugin name.- Specified by:
setName
in interfaceFileImporter
- Parameters:
name
- a string holding the name
-
getDocType
Description copied from interface:FileImporter
Returns the document type configured for thisFileImporter
,null
if no document type is configured.- Specified by:
getDocType
in interfaceFileImporter
-
setDocType
Description copied from interface:FileImporter
Sets the document type configured for this importer.- Specified by:
setDocType
in interfaceFileImporter
-
getDocType
Gets the doc type to use in the given container. -
getDefaultDocType
Default document type to use when the plugin XML configuration does not specify one.To implement when the default
createOrUpdate(FileImporterContext)
method is used. -
isOverwriteByTitle
protected boolean isOverwriteByTitle()Whether document overwrite is detected by checking title or filename.To implement when the default
createOrUpdate(FileImporterContext)
method is used. -
createDocument
Creates the document (sets its properties).updateDocument(org.nuxeo.ecm.core.api.DocumentModel, org.nuxeo.ecm.core.api.Blob)
will be called after this.Default implementation sets the title.
-
updateDocumentIfPossible
Tries to update the documentdoc
with the blobcontent
.Returns
true
if the document is really updated.- Since:
- 7.1
-
updateDocument
Updates the document (sets its properties).Default implementation sets the content.
-
getBlob
-
isOneToMany
public boolean isOneToMany()Description copied from interface:FileImporter
Returnstrue
ifFileImporter.createOrUpdate(FileImporterContext)
creates more than one document for the given blob,false
otherwise.- Specified by:
isOneToMany
in interfaceFileImporter
-
create
public DocumentModel create(CoreSession session, Blob content, String path, boolean overwrite, String fullname, TypeManager typeService) throws IOException Description copied from interface:FileImporter
Creates the document.- Specified by:
create
in interfaceFileImporter
- Parameters:
session
- the manager used to create the Documentcontent
- the content of the Filepath
- the path of current documentoverwrite
- a boolean deciding whether to create or update if we find a document with the same fileNamefullname
- the filename of the File- Throws:
IOException
-
createOrUpdate
Description copied from interface:FileImporter
Returns a created or updated document based on the givencontext
.- Specified by:
createOrUpdate
in interfaceFileImporter
- Throws:
IOException
- See Also:
-
getFileManagerService
Deprecated.since 10.3, useFramework.getService(Class)
instead if needed -
setFileManagerService
Deprecated.since 10.3, useFramework.getService(Class)
instead if neededDescription copied from interface:FileImporter
Embeds a reference to the holding FileManagerService instance to be able to reuse generic file creation utility methods in specific plugin implementations.- Specified by:
setFileManagerService
in interfaceFileImporter
- Parameters:
fileManagerService
- instance where the Plugin is registered as a contribution
-
setEnabled
public void setEnabled(boolean enabled) - Specified by:
setEnabled
in interfaceFileImporter
-
isEnabled
public boolean isEnabled()- Specified by:
isEnabled
in interfaceFileImporter
-
getOrder
Description copied from interface:FileImporter
Returns the plugin order for sorting.- Specified by:
getOrder
in interfaceFileImporter
-
setOrder
Description copied from interface:FileImporter
Sets the plugin order for sorting.- Specified by:
setOrder
in interfaceFileImporter
-
compareTo
- Specified by:
compareTo
in interfaceComparable<FileImporter>
-
getNearestContainerPath
Returns nearest container pathIf given path points to a folderish document, return it. Else, return parent path.
-
doSecurityCheck
@Deprecated protected void doSecurityCheck(CoreSession documentManager, String path, String typeName) Deprecated.since 11.3, useand #checkAllowedSubtypes(CoreSession, String, String)
instead- Since:
- 10.10
-
doSecurityCheck
@Deprecated protected void doSecurityCheck(CoreSession documentManager, String path, String typeName, TypeManager typeService) Deprecated.since 11.3, useand #checkAllowedSubtypes(CoreSession, String, String)
instead -
checkSecurity
- Since:
- 11.3
-
checkAllowedSubtypes
- Since:
- 11.3
-
CoreSession.DISABLE_AUDIT_LOGGER
instead