cluster5.server.datastorage.dao
Class FileDao

java.lang.Object
  extended by cluster5.server.datastorage.dao.FileDao

public class FileDao
extends java.lang.Object


Constructor Summary
FileDao()
           
 
Method Summary
 boolean deleteFile(java.lang.Long fileId)
          Deletes a file indentified by its ID from database.
 SharedFile get(java.lang.Long userId, java.lang.Long projectId, SharedFile.Type type, java.lang.String filename, java.lang.String canonicalClassName)
           
 SharedFile getById(java.lang.Long fileId)
           
 java.util.List<SharedFile> listAllFiles()
          Lists all files in the database without loading binary data.
 java.util.List<java.lang.Long> listFileIds(java.lang.Long userId, java.lang.Long projectId)
           
 SharedFile save(SharedFile file)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileDao

public FileDao()
Method Detail

save

public SharedFile save(SharedFile file)

getById

public SharedFile getById(java.lang.Long fileId)
Parameters:
fileId -
Returns:
instance of a SharedFile by given ID or null if there is no such record

get

public SharedFile get(java.lang.Long userId,
                      java.lang.Long projectId,
                      SharedFile.Type type,
                      java.lang.String filename,
                      java.lang.String canonicalClassName)
Parameters:
userId -
projectId -
type -
filename -
canonicalClassName -
Returns:
instance of a SharedFile by given parameters or null

deleteFile

public boolean deleteFile(java.lang.Long fileId)
Deletes a file indentified by its ID from database.

Parameters:
fileId -
Returns:
true on operation success

listFileIds

public java.util.List<java.lang.Long> listFileIds(java.lang.Long userId,
                                                  java.lang.Long projectId)
Parameters:
userId -
projectId -
Returns:
list of shared file IDs according to specified parameters

listAllFiles

public java.util.List<SharedFile> listAllFiles()
Lists all files in the database without loading binary data.

Returns:
list of SharedFile or an empty list if there are none