Module Dropins/Core

This module is undocumented. This is a list of its definitions.

filterSupportedExtensions :: String -> <Proc> [String]

Every file name pattern handled by the import services that also handle the given one, so filterSupportedExtensions "*.xls" answers with the whole pattern set of the spreadsheet importer. Patterns are written in the glob form "*.xls", not in the dotted form the import functions take.

getUploadedDropinFiles :: () -> <Proc> [Long]

The resource identifiers of the entities imported from dropped files, that is the values of getUploadedFiles without their names.

getUploadedFiles :: () -> <Proc> MMap.T String Long

The entities imported from dropped files so far, as a map from the name of the entity to the identifier of its resource.

importGenericFile :: String -> <Proc> String

Imports the file at the given path with the import service registered for its file name extension, placing the result under that service's default parent. Returns the identifier of the created resource as a string. Fails if the path has no extension or no service handles it.

importGenericFileToResource :: String -> String -> <Proc> Resource

As importGenericFileWithExtension, but returns the created resource instead of its identifier as a string.

importGenericFileToResource2 :: String -> <Proc> Resource

As importGenericFile, but returns the created resource instead of its identifier as a string.

importGenericFileWithExtension :: String -> String -> <Proc> String

As importGenericFile, but the extension deciding which import service is used is given separately, written with the leading dot as in ".xlsx". This allows importing a file whose name does not carry its real extension.

importGenericFileWithExtensionAndParent :: Resource -> String -> String -> <Proc> Resource

importGenericFileWithExtensionAndParent parent path extension imports a file under an explicitly given parent resource instead of the import service's default parent, and returns the created resource.

performFileImport :: String -> String -> <Proc> String

performFileImport base64 name writes Base64 content into a file of that name in the workspace models folder and imports it with the service registered for its extension. Returns the identifier of the created resource as a string. Unlike the other import functions here, a failure during the import is raised rather than only logged.

removeFileForId :: Long -> <Proc> ()

Removes the entity that was imported for the given resource identifier and deletes the file it came from. Does nothing if no dropped file is recorded for the identifier.

unwatchDropinsFolder :: () -> <Proc> ()

Stops the watcher started by watchDropinsFolder. Files already imported stay in the database.

uploadToDropinsBase64 :: String -> String -> <Proc> ()

uploadToDropinsBase64 base64 fileName decodes Base64 content into a file of that name in the dropins folder, which makes the watcher import it. The watcher is started first if it is not running. If a file of that name is already there, a numeric suffix is added instead of overwriting. A failure to write the file is logged rather than raised.

watchDropinsFolder :: () -> <Proc> ()

Starts watching the workspace dropins folder. A file dropped into the folder is imported by the import service registered for its extension, and deleting a file removes the entity that was imported from it. Calling this again while the watcher runs does nothing.