|
3.1.2: 2012-07-31 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.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,
boolean requireValid)
Get the file of the given data file type in the FileStoreEnabled item's file set assuming that at most
one file exists. |
static List<File> |
getDataFiles(DbControl dc,
FileStoreEnabled item,
String dataFileType,
boolean requireValid)
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 ItemSubtype in a given item's file
set. |
static List<FileSetMember> |
getGenericMembers(DbControl dc,
FileStoreEnabled item,
String genericType)
Get all file members with a specific generic ItemSubtype in a given item's file
set. |
static List<PlatformFileType> |
getGenericPlatformFileTypes(DbControl dc,
FileStoreEnabled item,
String genericType)
Get a list of all platform file types that has the specified generic ItemSubtype . |
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 ItemSubtype . |
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, boolean requireValid)
FileStoreEnabled
item's file set assuming that at most
one file exists.
dc
- DbControl used to access the database.item
- The FileStoreEnabled
item to checkdataFileType
- The external ID of the DataFileType
to check forrequireValid
- TRUE to only get the data file if is a valid or unvalidated
file
PermissionDeniedException
- If the logged in user doesn't have
read permission to the filepublic static List<File> getDataFiles(DbControl dc, FileStoreEnabled item, String dataFileType, boolean requireValid)
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 forrequireValid
- TRUE to only get the data file if is a valid or unvalidated
file
PermissionDeniedException
- If the logged in user doesn't have
read permission to the filepublic static List<File> getGenericDataFiles(DbControl dc, FileStoreEnabled item, String genericType)
ItemSubtype
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.getItemSubtype()
.
dc
- A DbControl to use for database accessitem
- The FileStoreEnabled
item to checkgenericType
- The system ID of the ItemSubtype
to check for
public static List<FileSetMember> getGenericMembers(DbControl dc, FileStoreEnabled item, String genericType)
ItemSubtype
in a given item's file
set. Note! This method will only return members that the logged in user
has permission to read the file. Other members in the file set will be ignored.
Note! This method checks the file type from DataFileType.getGenericType()
,
not the file type from File.getItemSubtype()
.
dc
- A DbControl to use for database accessitem
- The FileStoreEnabled
item to checkgenericType
- The system ID of the ItemSubtype
to check for
public static List<PlatformFileType> getGenericPlatformFileTypes(DbControl dc, FileStoreEnabled item, String genericType)
ItemSubtype
.
If the item doesn't have any associated platform or variant, no file types are returned.
dc
- A DbControl to use for database accessitem
- The FileStoreEnabled
item to checkgenericType
- The system ID of the ItemSubtype
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 ItemSubtype
. Note! This method checks the file
type from DataFileType.getGenericType()
,
not the file type from File.getItemSubtype()
.
dc
- A DbControl to use for database accessitem
- The item to add/remove the file to/fromgenericType
- The system ID of the generic ItemSubtype
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
|
3.1.2: 2012-07-31 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |