org.loom.persistence.file
Class DatabaseFileManager

java.lang.Object
  extended by org.loom.persistence.file.DatabaseFileManager
All Implemented Interfaces:
FileManager

@Service
public class DatabaseFileManager
extends java.lang.Object
implements FileManager

Handles file upload and download


Constructor Summary
DatabaseFileManager()
           
 
Method Summary
 PersistentFile find(java.lang.Integer id)
           
protected  org.springframework.jdbc.support.lob.LobHandler getLobHandler()
           
 PersistentFile merge(FileParameter parameter)
          Stores a file in the database and return the persistent instance
 PersistentFile merge(PersistentFile file)
          Stores a file in the database and return the persistent instance
 PersistentFile remove(java.lang.Integer id)
          Removes a persistent file from the database
protected  BlobPersistentFileContents saveContents(PersistentFile file, java.io.InputStream input, boolean update)
          Persist the file contents into the database
 void setContentsColumnName(java.lang.String contentsColumnName)
           
 void setDataSource(javax.sql.DataSource dataSource)
           
 void setEntityManager(ExtendedEntityManager entityManager)
           
 void setFileTableName(java.lang.String fileTableName)
           
 void setLobHandler(org.springframework.jdbc.support.lob.LobHandler lobHandler)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatabaseFileManager

public DatabaseFileManager()
Method Detail

merge

@Transactional
public PersistentFile merge(FileParameter parameter)
Description copied from interface: FileManager
Stores a file in the database and return the persistent instance

Specified by:
merge in interface FileManager
Parameters:
parameter - the uploaded parameter file
Returns:
the persisted instance

merge

@Transactional
public PersistentFile merge(PersistentFile file)
Description copied from interface: FileManager
Stores a file in the database and return the persistent instance

Specified by:
merge in interface FileManager
Parameters:
file - the modified file to store
Returns:
the persisted instance

saveContents

protected BlobPersistentFileContents saveContents(PersistentFile file,
                                                  java.io.InputStream input,
                                                  boolean update)
Persist the file contents into the database

Parameters:
file - The PersistentFile instance
update - true to update an already existing file, false to insert a new one

find

public PersistentFile find(java.lang.Integer id)
Specified by:
find in interface FileManager
Parameters:
id - the persistent file id
Returns:
the persistent file entity

remove

@Transactional
public PersistentFile remove(java.lang.Integer id)
Description copied from interface: FileManager
Removes a persistent file from the database

Specified by:
remove in interface FileManager
Parameters:
id - the file id to remove
Returns:
the removed file entity

setDataSource

@Inject
public void setDataSource(javax.sql.DataSource dataSource)

setContentsColumnName

public void setContentsColumnName(java.lang.String contentsColumnName)

setFileTableName

public void setFileTableName(java.lang.String fileTableName)

setLobHandler

public void setLobHandler(org.springframework.jdbc.support.lob.LobHandler lobHandler)

getLobHandler

protected org.springframework.jdbc.support.lob.LobHandler getLobHandler()

setEntityManager

public void setEntityManager(ExtendedEntityManager entityManager)