public abstract class AbstractFileImporter extends Object implements FileImporter
Default file importer behavior.
FileImporter
,
Serialized FormModifier and Type | Field and Description |
---|---|
static String |
DISABLE_AUDIT_LOGGER |
protected String |
docType |
protected boolean |
enabled |
protected FileManagerService |
fileManagerService |
protected List<String> |
filters |
protected String |
name |
protected Integer |
order |
protected List<Pattern> |
patterns |
static String |
SKIP_UPDATE_AUDIT_LOGGING |
Constructor and Description |
---|
AbstractFileImporter() |
Modifier and Type | Method and Description |
---|---|
protected void |
checkIn(DocumentModel doc)
Deprecated.
since 9.1 automatic versioning is now handled at versioning service level, remove versioning
behaviors from importers
|
protected void |
checkInAfterAdd(DocumentModel doc)
Deprecated.
since 9.1 automatic versioning is now handled at versioning service level, remove versioning
behaviors from importers
|
int |
compareTo(FileImporter other) |
DocumentModel |
create(CoreSession session,
Blob content,
String path,
boolean overwrite,
String fullname,
TypeManager typeService)
Creates the document.
|
void |
createDocument(DocumentModel doc,
Blob content,
String title)
Creates the document (sets its properties).
|
protected void |
doSecurityCheck(CoreSession documentManager,
String path,
String typeName,
TypeManager typeService) |
Blob |
getBlob(DocumentModel doc) |
String |
getDefaultDocType()
Default document type to use when the plugin XML configuration does not specify one.
|
String |
getDocType()
Returns the document type configured for this
FileImporter , null if no document type is
configured. |
String |
getDocType(DocumentModel container)
Gets the doc type to use in the given container.
|
FileManagerService |
getFileManagerService() |
List<String> |
getFilters()
Gets filters.
|
String |
getName()
Gets the plugin name.
|
protected String |
getNearestContainerPath(CoreSession documentManager,
String path)
Returns nearest container path
|
Integer |
getOrder()
Returns the plugin order for sorting.
|
boolean |
isEnabled() |
boolean |
isOverwriteByTitle()
Whether document overwrite is detected by checking title or filename.
|
boolean |
matches(String mimeType)
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)
Embeds a reference to the holding FileManagerService instance to be able to reuse generic file creation utility
methods in specific plugin implementations.
|
void |
setFilters(List<String> filters)
Sets filters.
|
void |
setName(String name)
Sets plugin name.
|
void |
setOrder(Integer order)
Sets the plugin order for sorting.
|
protected boolean |
skipCheckInForBlob(Blob blob)
Deprecated.
since 9.1 automatic versioning is now handled at versioning service level, remove versioning
behaviors from importers
|
void |
updateDocument(DocumentModel doc,
Blob content)
Updates the document (sets its properties).
|
boolean |
updateDocumentIfPossible(DocumentModel doc,
Blob content)
Tries to update the document
doc with the blob content . |
protected boolean enabled
public static final String SKIP_UPDATE_AUDIT_LOGGING
public static final String DISABLE_AUDIT_LOGGER
protected FileManagerService fileManagerService
public AbstractFileImporter()
public List<String> getFilters()
FileImporter
The filters are all the mime/type this plugin can deal with.
getFilters
in interface FileImporter
public void setFilters(List<String> filters)
FileImporter
The filters are all the mime/types this plugin can deal with.
setFilters
in interface FileImporter
filters
- a list of strings representing each filterpublic boolean matches(String mimeType)
FileImporter
matches
in interface FileImporter
mimeType
- the mimetype to testpublic String getName()
FileImporter
getName
in interface FileImporter
public void setName(String name)
FileImporter
setName
in interface FileImporter
name
- a string holding the namepublic String getDocType()
FileImporter
FileImporter
, null
if no document type is
configured.getDocType
in interface FileImporter
public void setDocType(String docType)
FileImporter
setDocType
in interface FileImporter
public String getDocType(DocumentModel container)
public String getDefaultDocType()
To implement when the default create(org.nuxeo.ecm.core.api.CoreSession, org.nuxeo.ecm.core.api.Blob, java.lang.String, boolean, java.lang.String, org.nuxeo.ecm.platform.types.TypeManager)
method is used.
public boolean isOverwriteByTitle()
To implement when the default create(org.nuxeo.ecm.core.api.CoreSession, org.nuxeo.ecm.core.api.Blob, java.lang.String, boolean, java.lang.String, org.nuxeo.ecm.platform.types.TypeManager)
method is used.
public void createDocument(DocumentModel doc, Blob content, String title)
updateDocument(org.nuxeo.ecm.core.api.DocumentModel, org.nuxeo.ecm.core.api.Blob)
will be called after this.
Default implementation sets the title.
public boolean updateDocumentIfPossible(DocumentModel doc, Blob content)
doc
with the blob content
.
Returns true
if the document is really updated.
public void updateDocument(DocumentModel doc, Blob content)
Default implementation sets the content.
public Blob getBlob(DocumentModel doc)
public DocumentModel create(CoreSession session, Blob content, String path, boolean overwrite, String fullname, TypeManager typeService) throws IOException
FileImporter
create
in interface FileImporter
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 FileIOException
@Deprecated protected boolean skipCheckInForBlob(Blob blob)
public FileManagerService getFileManagerService()
public void setFileManagerService(FileManagerService fileManagerService)
FileImporter
setFileManagerService
in interface FileImporter
fileManagerService
- instance where the Plugin is registered as a contributionpublic void setEnabled(boolean enabled)
setEnabled
in interface FileImporter
public boolean isEnabled()
isEnabled
in interface FileImporter
public Integer getOrder()
FileImporter
getOrder
in interface FileImporter
public void setOrder(Integer order)
FileImporter
setOrder
in interface FileImporter
public int compareTo(FileImporter other)
compareTo
in interface Comparable<FileImporter>
protected String getNearestContainerPath(CoreSession documentManager, String path)
If given path points to a folderish document, return it. Else, return parent path.
@Deprecated protected void checkIn(DocumentModel doc)
@Deprecated protected void checkInAfterAdd(DocumentModel doc)
protected void doSecurityCheck(CoreSession documentManager, String path, String typeName, TypeManager typeService) throws DocumentSecurityException
DocumentSecurityException
Copyright © 2018 Nuxeo. All rights reserved.