public class DocumentStorageServiceImpl extends Object implements DocumentStorageService
| Constructor and Description |
|---|
DocumentStorageServiceImpl() |
DocumentStorageServiceImpl(String storagePath) |
| Modifier and Type | Method and Description |
|---|---|
Document |
buildDocument(String name,
long size,
Date lastModified,
Map<String,String> params)
Generates a Document instance.
|
boolean |
deleteDocument(Document doc)
Deletes the File identified by the given id
|
boolean |
deleteDocument(String id)
Deletes the File identified by the given id
|
protected boolean |
deleteFile(File file) |
protected String |
generateUniquePath()
Generates a random path to store the file to avoid overwritting files with the same name
|
Document |
getDocument(String id)
Method to obtain a File for the given storage id
|
File |
getDocumentContent(Document doc) |
protected File |
getFileByPath(String path) |
Document |
saveDocument(Document document,
byte[] content)
Method to store the uploaded file on the system
|
public DocumentStorageServiceImpl(String storagePath)
public DocumentStorageServiceImpl()
public Document buildDocument(String name, long size, Date lastModified, Map<String,String> params)
DocumentStorageServicebuildDocument in interface DocumentStorageServicename - The document namesize - The document sizelastModified - The lastModified date of the documentparams - A Mappublic Document saveDocument(Document document, byte[] content)
DocumentStorageServicesaveDocument in interface DocumentStorageServicedocument - The document to store the contentcontent - The document contentpublic Document getDocument(String id)
DocumentStorageServicegetDocument in interface DocumentStorageServiceid - The Document id to obtain the Documentpublic boolean deleteDocument(String id)
DocumentStorageServicedeleteDocument in interface DocumentStorageServiceid - The Document id to deletepublic boolean deleteDocument(Document doc)
DocumentStorageServicedeleteDocument in interface DocumentStorageServicedoc - The Document to deleteprotected boolean deleteFile(File file)
protected String generateUniquePath()
Copyright © 2001–2016 JBoss by Red Hat. All rights reserved.