jBPM :: Document Service 6.2.0.Beta1

org.jbpm.document.service.impl
Class DocumentStorageServiceImpl

java.lang.Object
  extended by org.jbpm.document.service.impl.DocumentStorageServiceImpl
All Implemented Interfaces:
DocumentStorageService

public class DocumentStorageServiceImpl
extends Object
implements DocumentStorageService

This a Sample Implementation of the DocumentStorageService saves the uploaded files on the File System on a folder (by default /docs) and return the complete path to the file that will be stored in the form field property. Check that the user that is running the app has write permissions on the storage folder.


Constructor Summary
DocumentStorageServiceImpl()
           
 
Method Summary
 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(String fileName)
          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)
           
 Document saveDocument(Document document, byte[] content)
          Method to store the uploaded file on the system
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DocumentStorageServiceImpl

public DocumentStorageServiceImpl()
Method Detail

saveDocument

public Document saveDocument(Document document,
                             byte[] content)
Description copied from interface: DocumentStorageService
Method to store the uploaded file on the system

Specified by:
saveDocument in interface DocumentStorageService
Parameters:
document - The document to store the content
content - The document content
Returns:
A Document

getDocument

public Document getDocument(String id)
Description copied from interface: DocumentStorageService
Method to obtain a File for the given storage id

Specified by:
getDocument in interface DocumentStorageService
Parameters:
id - The Document id to obtain the Document
Returns:
The java.io.File identified with the id

deleteDocument

public boolean deleteDocument(String id)
Description copied from interface: DocumentStorageService
Deletes the File identified by the given id

Specified by:
deleteDocument in interface DocumentStorageService
Parameters:
id - The Document id to delete
Returns:
true if it was possible to remove, false if not

deleteDocument

public boolean deleteDocument(Document doc)
Description copied from interface: DocumentStorageService
Deletes the File identified by the given id

Specified by:
deleteDocument in interface DocumentStorageService
Parameters:
doc - The Document to delete
Returns:
true if it was possible to remove, false if not

getDocumentContent

public File getDocumentContent(Document doc)

deleteFile

protected boolean deleteFile(File file)

generateUniquePath

protected String generateUniquePath(String fileName)
Generates a random path to store the file to avoid overwritting files with the same name

Parameters:
fileName - The fileName that is going to be stored
Returns:
A String

jBPM :: Document Service 6.2.0.Beta1

Copyright © 2001-2014 JBoss by Red Hat. All Rights Reserved.