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
FieldsModifier and TypeFieldDescriptionstatic final StringDeprecated.protected Stringprotected booleanprotected FileManagerServiceDeprecated.since 10.3, useFramework.getService(Class)instead if neededprotected Stringprotected Integerstatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcheckAllowedSubtypes(CoreSession session, String path, String typeName) protected voidcheckSecurity(CoreSession session, String path) intcompareTo(FileImporter other) create(CoreSession session, Blob content, String path, boolean overwrite, String fullname, TypeManager typeService) Creates the document.protected voidcreateDocument(DocumentModel doc, String title) Creates the document (sets its properties).createOrUpdate(FileImporterContext context) Returns a created or updated document based on the givencontext.protected voiddoSecurityCheck(CoreSession documentManager, String path, String typeName) Deprecated.since 11.3, useand #checkAllowedSubtypes(CoreSession, String, String)insteadprotected voiddoSecurityCheck(CoreSession documentManager, String path, String typeName, TypeManager typeService) Deprecated.since 11.3, useand #checkAllowedSubtypes(CoreSession, String, String)insteadprotected BlobgetBlob(DocumentModel doc) protected StringDefault document type to use when the plugin XML configuration does not specify one.Returns the document type configured for thisFileImporter,nullif no document type is configured.protected StringgetDocType(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 StringgetNearestContainerPath(CoreSession documentManager, String path) Returns nearest container pathgetOrder()Returns the plugin order for sorting.booleanbooleanReturnstrueifFileImporter.createOrUpdate(FileImporterContext)creates more than one document for the given blob,falseotherwise.protected booleanWhether document overwrite is detected by checking title or filename.booleanTests whether plugin is suitable for the given mimetype.voidsetDocType(String docType) Sets the document type configured for this importer.voidsetEnabled(boolean enabled) voidsetFileManagerService(FileManagerService fileManagerService) Deprecated.since 10.3, useFramework.getService(Class)instead if neededvoidsetFilters(List<String> filters) Sets filters.voidSets plugin name.voidSets the plugin order for sorting.protected voidupdateDocument(DocumentModel doc, Blob content) Updates the document (sets its properties).protected booleanupdateDocumentIfPossible(DocumentModel doc, Blob content) Tries to update the documentdocwith 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_LOGGERinsteadOriginally 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:FileImporterGets filters.The filters are all the mime/type this plugin can deal with.
- Specified by:
getFiltersin interfaceFileImporter- Returns:
- list of string holding each filters.
-
setFilters
Description copied from interface:FileImporterSets filters.The filters are all the mime/types this plugin can deal with.
- Specified by:
setFiltersin interfaceFileImporter- Parameters:
filters- a list of strings representing each filter
-
matches
Description copied from interface:FileImporterTests whether plugin is suitable for the given mimetype.- Specified by:
matchesin interfaceFileImporter- Parameters:
mimeType- the mimetype to test
-
getName
Description copied from interface:FileImporterGets the plugin name.- Specified by:
getNamein interfaceFileImporter- Returns:
- a string holding the plugin name
-
setName
Description copied from interface:FileImporterSets plugin name.- Specified by:
setNamein interfaceFileImporter- Parameters:
name- a string holding the name
-
getDocType
Description copied from interface:FileImporterReturns the document type configured for thisFileImporter,nullif no document type is configured.- Specified by:
getDocTypein interfaceFileImporter
-
setDocType
Description copied from interface:FileImporterSets the document type configured for this importer.- Specified by:
setDocTypein 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 documentdocwith the blobcontent.Returns
trueif 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:FileImporterReturnstrueifFileImporter.createOrUpdate(FileImporterContext)creates more than one document for the given blob,falseotherwise.- Specified by:
isOneToManyin interfaceFileImporter
-
create
public DocumentModel create(CoreSession session, Blob content, String path, boolean overwrite, String fullname, TypeManager typeService) throws IOException Description copied from interface:FileImporterCreates the document.- Specified by:
createin 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:FileImporterReturns a created or updated document based on the givencontext.- Specified by:
createOrUpdatein 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:FileImporterEmbeds a reference to the holding FileManagerService instance to be able to reuse generic file creation utility methods in specific plugin implementations.- Specified by:
setFileManagerServicein interfaceFileImporter- Parameters:
fileManagerService- instance where the Plugin is registered as a contribution
-
setEnabled
public void setEnabled(boolean enabled) - Specified by:
setEnabledin interfaceFileImporter
-
isEnabled
public boolean isEnabled()- Specified by:
isEnabledin interfaceFileImporter
-
getOrder
Description copied from interface:FileImporterReturns the plugin order for sorting.- Specified by:
getOrderin interfaceFileImporter
-
setOrder
Description copied from interface:FileImporterSets the plugin order for sorting.- Specified by:
setOrderin interfaceFileImporter
-
compareTo
- Specified by:
compareToin 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_LOGGERinstead