public class DocumentStoreStrategy
Provides java.io.File directories for saving net.doo.snap.entity.Document
The structure of the document folder is the following: {documents_directory}/document UUID -------{document_name}.pdf -------{thumbnail}
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
TEMPORARY_FILE_PREFIX |
static java.lang.String |
THUMBNAIL_FILE_NAME |
| Constructor and Description |
|---|
DocumentStoreStrategy() |
| Modifier and Type | Method and Description |
|---|---|
boolean |
ensureDocumentDir() |
void |
ensureDocumentDirectory()
Creates directory for net.doo.snap.entity.Document if not exists.
|
void |
eraseDocument()
Deletes Document directory and all its pages from file system Use from BG thread only
|
java.io.File |
getDocumentDir() |
java.io.File |
getDocumentDirForSharing() |
java.io.File |
getDocumentFile() |
java.io.File |
getDocumentFileForSharing() |
java.io.File |
getDocumentsDir() |
java.io.File |
getDocumentsDirForSharing() |
java.io.File |
getDocumentsExternalDir() |
java.util.List<java.io.File> |
getDocumentsFiles() |
java.lang.String |
getPageImagePath() |
java.io.File |
getTemporaryDocumentFile() |
java.io.File |
getThumbnailFile() |
java.lang.String |
getUniqueName()
Recursively trying to find unique name for pdf document in pdf files directory
|
void |
migrateDocuments()
Migrates all pdf files to directory specified in preferences
net.doo.snap.PreferencesConstants#EXTERNAL_DIR or default directory net.doo.snap.Constants#DEFAULT_EXTERNAL_DIR_NAME or from external directory to internal application document directories. Use from BG thread only. |
boolean |
renameDocument()
Renames document. Use from BG thread only
|
public static java.lang.String THUMBNAIL_FILE_NAME
public static java.lang.String TEMPORARY_FILE_PREFIX
public boolean ensureDocumentDir()
true if the given docDir has a correct structure (pdf document and it's thumbnail), false otherwisepublic java.io.File getDocumentsDir()
null if not possible to createIOException - if directory can't be openedpublic java.io.File getDocumentsExternalDir()
null if not possible to createIOException - if directory can't be openedpublic java.io.File getDocumentsDirForSharing()
null if not possible to createIOException - if directory can't be openedpublic java.io.File getDocumentDirForSharing()
null if it does not exist or is not accessibleIOException - if directory can't be openedpublic java.io.File getDocumentDir()
null if it does not exist or is not accessibleIOException - if directory can't be openedpublic void ensureDocumentDirectory()
Creates directory for net.doo.snap.entity.Document if not exists.
public java.io.File getDocumentFile()
null if there were problems accessing FSIOException - if java.io.File can't be openedpublic java.util.List<java.io.File> getDocumentsFiles()
null if there were problems accessing FSIOException - if java.io.File can't be openedpublic java.io.File getThumbnailFile()
null if there were problems accessing FSIOException - if java.io.File can't be openedpublic java.io.File getTemporaryDocumentFile()
public java.io.File getDocumentFileForSharing()
public void eraseDocument()
Deletes Document directory and all its pages from file system Use from BG thread only
public boolean renameDocument()
Renames document. Use from BG thread only
true if file was successfully renamed, false - otherwisepublic java.lang.String getUniqueName()
Recursively trying to find unique name for pdf document in pdf files directory
public java.lang.String getPageImagePath()
public void migrateDocuments()
Migrates all pdf files to directory specified in preferences net.doo.snap.PreferencesConstants#EXTERNAL_DIR or default directory net.doo.snap.Constants#DEFAULT_EXTERNAL_DIR_NAME or from external directory to internal application document directories.
Use from BG thread only.