|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.basedb.core.FileStoreUtil
public class FileStoreUtil
Utility class working with FileStoreEnabled
items.
Constructor Summary | |
---|---|
FileStoreUtil()
|
Method Summary | |
---|---|
static File |
getDataFile(DbControl dc,
FileStoreEnabled item,
String dataFileType)
Get the file of the given data file type in the FileStoreEnabled item's file set. |
static List<File> |
getGenericDataFiles(DbControl dc,
FileStoreEnabled item,
String genericType)
Get all files with a specific generic FileType in a given item's file
set. |
static boolean |
hasDataFile(DbControl dc,
FileStoreEnabled item,
String dataFileType,
boolean requireValid)
Check if a file of the given data file type is present in a FileStoreEnabled item's file set. |
static FileSetMember |
setDataFile(DbControl dc,
FileStoreEnabled item,
String dataFileType,
File file)
Set or remove a file to FileStoreEnabled item based on
the file's DataFileType . |
static FileSetMember |
setGenericDataFile(DbControl dc,
FileStoreEnabled item,
String genericType,
String fallbackDataFileType,
File file)
Set or remove a file to FileStoreEnabled item based
on the file's generic FileType . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public FileStoreUtil()
Method Detail |
---|
public static boolean hasDataFile(DbControl dc, FileStoreEnabled item, String dataFileType, boolean requireValid)
FileStoreEnabled
item's file set. Optionally, check if the
file has been validated as a valid file.
dc
- DbControl to use when accessing the database.item
- The FileStoreEnabled
item to checkdataFileType
- The external ID of the DataFileType
to check forrequireValid
- TRUE if the file must exist and be valid, FALSE if
it must only exist. This parameter is ignored if the data file type
doesn't have a validator
public static File getDataFile(DbControl dc, FileStoreEnabled item, String dataFileType)
FileStoreEnabled
item's file set.
dc
- DbControl used to access the database.item
- The FileStoreEnabled
item to checkdataFileType
- The external ID of the DataFileType
to check for
PermissionDeniedException
- If the logged in user doesn't have
read permission to the filepublic static List<File> getGenericDataFiles(DbControl dc, FileStoreEnabled item, String genericType)
FileType
in a given item's file
set. Note! This method will only return files that the logged in user
has permission to read. Other files in the file set will be ignored.
Note! This method checks the file type from DataFileType.getGenericType()
,
not the file type from File.getFileType()
.
dc
- A DbControl to use for database accessitem
- The FileStoreEnabled
item to checkgenericType
- The system ID of the FileType
to check for
public static FileSetMember setDataFile(DbControl dc, FileStoreEnabled item, String dataFileType, File file)
FileStoreEnabled
item based on
the file's DataFileType
.
dc
- A DbControl to use for database accessitem
- The item to add/remove the file to/fromdataFileType
- The external ID of the DataFileType
of the filefile
- The file, or null to remove an existing file
PermissionDeniedException
- If the logged in user
doesn't have write permission to the item
InvalidUseOfNullException
- If item is nullpublic static FileSetMember setGenericDataFile(DbControl dc, FileStoreEnabled item, String genericType, String fallbackDataFileType, File file)
FileStoreEnabled
item based
on the file's generic FileType
. Note! This method checks the file
type from DataFileType.getGenericType()
,
not the file type from File.getFileType()
.
dc
- A DbControl to use for database accessitem
- The item to add/remove the file to/fromgenericType
- The system ID of the generic FileType
fallbackDataFileType
- The external ID of a DataFileType
that is used
if the specified generic file type isn't found among the file types
registered for the platformfile
- The file, or null to remove an existing file
PermissionDeniedException
- If the logged in user
doesn't have write permission to the item
InvalidUseOfNullException
- If item is null
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |