Package com.logicaldoc.importfolder.fs
Class FSHelper
java.lang.Object
com.logicaldoc.importfolder.CrawlerHelper
com.logicaldoc.importfolder.fs.FSHelper
Helper for local file system import folders
- Since:
- 4.5
- Author:
- Marco Meschieri - LogicalDOC
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
checkinFile
(Object file, long docId, com.logicaldoc.core.security.User owner) Imports a remote file into an existing document producing a new versionboolean
deleteFile
(Object file) Delete the given referenced file after document import.getContentFile
(String path) Retrieves a file that contains the content referenced by pathgetCreationDate
(Object file) Computes remote file creation dateGets the object representation of the given pathgetLastModified
(Object file) Computes remote file last modification timeComputes the name of the remote fileComputes the path of the remote fileint
The documents, referenced by a index file, that should be imported.com.logicaldoc.core.document.Document
importFile
(Object file, com.logicaldoc.core.folder.Folder folder, com.logicaldoc.core.security.User owner, boolean timestamp) Imports a remote filevoid
importUsingIndex
(ImportFolderCrawler crawler) Imports documents referenced by a index filevoid
list
(Object parent, int depth, List<Object> folders, List<Object> files, long max, ImportFolderCache cache) Lists all files in a remote folderboolean
Tests if the import folder can be accessedMethods inherited from class com.logicaldoc.importfolder.CrawlerHelper
getInstance, toBeImported
-
Constructor Details
-
FSHelper
public FSHelper(ImportFolder importFolder, ImportFolderCrawler crawler) throws com.logicaldoc.core.PersistenceException - Throws:
com.logicaldoc.core.PersistenceException
-
-
Method Details
-
checkinFile
public void checkinFile(Object file, long docId, com.logicaldoc.core.security.User owner) throws IOException, com.logicaldoc.core.PersistenceException Description copied from class:CrawlerHelper
Imports a remote file into an existing document producing a new version- Specified by:
checkinFile
in classCrawlerHelper
- Parameters:
file
- The file to be loadeddocId
- The document identifierowner
- The owner user- Throws:
IOException
- I/O errorcom.logicaldoc.core.PersistenceException
- Error in the database layer
-
importFile
public com.logicaldoc.core.document.Document importFile(Object file, com.logicaldoc.core.folder.Folder folder, com.logicaldoc.core.security.User owner, boolean timestamp) throws com.logicaldoc.core.PersistenceException, IOException Description copied from class:CrawlerHelper
Imports a remote file- Specified by:
importFile
in classCrawlerHelper
- Parameters:
file
- The file to be loadedfolder
- The target folderowner
- The owner usertimestamp
- If the timestamp has to be included in filename and title- Returns:
- The newly created document
- Throws:
com.logicaldoc.core.PersistenceException
- Error in the data layerIOException
- I/O exception
-
list
public void list(Object parent, int depth, List<Object> folders, List<Object> files, long max, ImportFolderCache cache) Description copied from class:CrawlerHelper
Lists all files in a remote folder- Specified by:
list
in classCrawlerHelper
- Parameters:
parent
- The parent directorydepth
- The maximum depthfolders
- The list that will contain all allowed foldersfiles
- The list that will contain all allowed filesmax
- The maximum number of elements in filescache
- Cache of imported documents
-
getPath
Description copied from class:CrawlerHelper
Computes the path of the remote file- Specified by:
getPath
in classCrawlerHelper
- Parameters:
file
- The file to be considered- Returns:
- The path
-
getName
Description copied from class:CrawlerHelper
Computes the name of the remote file- Specified by:
getName
in classCrawlerHelper
- Parameters:
file
- The file to be considered- Returns:
- The name
-
getLastModified
Description copied from class:CrawlerHelper
Computes remote file last modification time- Specified by:
getLastModified
in classCrawlerHelper
- Parameters:
file
- The file to be considered- Returns:
- The last modification time
-
getCreationDate
Description copied from class:CrawlerHelper
Computes remote file creation date- Specified by:
getCreationDate
in classCrawlerHelper
- Parameters:
file
- The file to be considered- Returns:
- The creation date
-
importUsingIndex
public void importUsingIndex(ImportFolderCrawler crawler) throws com.logicaldoc.core.PersistenceException, IOException Description copied from class:CrawlerHelper
Imports documents referenced by a index file- Specified by:
importUsingIndex
in classCrawlerHelper
- Parameters:
crawler
- The current ImportFolderCrawler task- Throws:
com.logicaldoc.core.PersistenceException
- Error in the database layerIOException
- I/O error
-
importDocumentsCount
Description copied from class:CrawlerHelper
The documents, referenced by a index file, that should be imported. It returns -1 in case there is not index file- Specified by:
importDocumentsCount
in classCrawlerHelper
- Returns:
- number of documents references inside the index file
- Throws:
IOException
- I/O errorcom.logicaldoc.core.PersistenceException
- Error in the data layer
-
deleteFile
Description copied from class:CrawlerHelper
Delete the given referenced file after document import.- Specified by:
deleteFile
in classCrawlerHelper
- Parameters:
file
- The file that must be deleted- Returns:
- if the file has been successfully deleted
-
testConnection
public boolean testConnection()Description copied from class:CrawlerHelper
Tests if the import folder can be accessed- Specified by:
testConnection
in classCrawlerHelper
- Returns:
- true if the import folder is accessible
-
getContentFile
Description copied from class:CrawlerHelper
Retrieves a file that contains the content referenced by path- Specified by:
getContentFile
in classCrawlerHelper
- Parameters:
path
- the full path of a remote file- Returns:
- a local file containing the remote file's content
-
getFile
Description copied from class:CrawlerHelper
Gets the object representation of the given path- Specified by:
getFile
in classCrawlerHelper
- Parameters:
path
- the full path of a remote file- Returns:
- the remote file at the specified path
-