|
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.BasicItem<FileSetData> net.sf.basedb.core.FileSet
public class FileSet
A file set is the container for files that have been attach to an item to hold data instead of importing it to the database.
Nested Class Summary | |
---|---|
private static class |
FileSet.DataFileHandlerWrapper
Wraps a DataFileValidator and /or DataFileMetadataReader . |
private static class |
FileSet.QueryRuntimeFilterImpl
|
Field Summary | |
---|---|
private FileStoreEnabled |
item
The item this file set belongs to. |
private static QueryRuntimeFilter |
RUNTIME_FILTER
This filter gives everybody read permission to file sets. |
static Item |
TYPE
The type of item represented by this class. |
Constructor Summary | |
---|---|
FileSet(FileSetData data)
Regular constructor if the item is not known beforehand. |
|
FileSet(FileSetData data,
FileStoreEnabled item)
Special constructor to avoid getItem() to hit the database
when the item is known beforehand. |
Method Summary | |
---|---|
static FileSet |
getById(DbControl dc,
int id)
Get a FileSet item when you know the id. |
FileStoreEnabled |
getItem()
Get the item this file set belongs to. |
Item |
getItemType()
Get the Item type of the item this file set belongs to. |
FileSetMember |
getMember(DataFileType type)
Get the member of the given type. |
ItemQuery<FileSetMember> |
getMembers()
Get the members of this file set. |
ItemQuery<FileSetMember> |
getMembers(String genericType)
Get a query that returns all members in a file set with a specific generic FileType . |
ItemQuery<DataFileType> |
getMemberTypes()
Get a query that return the DataFileType for all members
of this file set. |
ItemQuery<PlatformFileType> |
getMissingDataFileTypes()
Get a query that is returning all file types that have been marked as required by the associated platform but has no member in this file set. |
(package private) static FileSet |
getNew(DbControl dc,
FileStoreEnabled item)
Create a new file set for the specified item. |
(package private) PluginPermission |
getPluginPermissions()
|
(package private) static ItemQuery<FileSet> |
getQuery()
Get a ItemQuery object configured to retrieve FileSet
items. |
Item |
getType()
Get the type of item represented by the object. |
Set<ItemProxy> |
getUsingItems()
Get the item this file set belongs to. |
boolean |
hasAllRequiredFiles()
Checks if this file set contains a file for each DataFileType that is required according to
what has been specified by the Platform and
PlatformVariant . |
boolean |
hasMember(DataFileType type)
Check if the file set contains a file of the specified type. |
(package private) void |
initPermissions(int granted,
int denied)
READ permission is granted to all users. |
boolean |
isUsed()
Always return TRUE. |
void |
removeAllMembers()
Remove all members in a file set. |
void |
removeMember(DataFileType type)
Remove the member of the given type. |
(package private) void |
setItem(FileStoreEnabled item)
Set the item this file set belongs to. |
FileSetMember |
setMember(File file,
DataFileType type)
Set a file of a given type as a member of this file set. |
List<Throwable> |
validate(DbControl dc,
boolean extractMetadata)
Validate the files in this file set. |
Methods inherited from class net.sf.basedb.core.BasicItem |
---|
addUsingItems, addUsingItems, checkPermission, equals, getData, getDbControl, getId, getPermissions, getSessionControl, getVersion, hashCode, hasPermission, isDetached, isInDatabase, onAfterCommit, onAfterInsert, onBeforeCommit, onRollback, setDbControl, setProjectDefaults, toString, toTransferable, validate |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final Item TYPE
Item.FILESET
,
getType()
private static final QueryRuntimeFilter RUNTIME_FILTER
private FileStoreEnabled item
Constructor Detail |
---|
FileSet(FileSetData data)
FileSet(FileSetData data, FileStoreEnabled item)
getItem()
to hit the database
when the item is known beforehand.
Method Detail |
---|
static FileSet getNew(DbControl dc, FileStoreEnabled item) throws BaseException
BaseException
public static FileSet getById(DbControl dc, int id) throws ItemNotFoundException, PermissionDeniedException, BaseException
FileSet
item when you know the id.
dc
- The DbControl
which will be used for
permission checking and database access.id
- The id of the item to load
FileSet
item
ItemNotFoundException
- If an item with the specified
id is not found
PermissionDeniedException
- If the logged in user doesn't
have read permission to the item
BaseException
- If there is another errorstatic ItemQuery<FileSet> getQuery()
ItemQuery
object configured to retrieve FileSet
items. This query may return items which the logged in user doesn't have
read permission to. At the moment there is no way to solve this problem.
ItemQuery
objectpublic Item getType()
Identifiable
Item
enumeration.
public boolean isUsed() throws BaseException
isUsed
in class BasicItem<FileSetData>
BaseException
- If not able to tell if item is used or not.BasicItem.getUsingItems()
public Set<ItemProxy> getUsingItems() throws BaseException
getUsingItems
in class BasicItem<FileSetData>
BaseException
- If there is an error loading the itemsBasicItem.addUsingItems(Set, Item, org.hibernate.Query)
void initPermissions(int granted, int denied) throws BaseException
initPermissions
in class BasicItem<FileSetData>
granted
- Permissions that have been granted by the subclassdenied
- Permissions that have been denied by the subclass
BaseException
- If the permissions couldn't be initialisedPluginPermission getPluginPermissions()
getPluginPermissions
in class BasicItem<FileSetData>
public FileStoreEnabled getItem() throws PermissionDeniedException, BaseException
FileStoreEnabled
item
PermissionDeniedException
- If the logged in user doesn't have
read permission to the item
BaseException
- If there is another errorvoid setItem(FileStoreEnabled item)
public Item getItemType()
Item
type of the item this file set belongs to.
public ItemQuery<FileSetMember> getMembers()
FileSetMember
itemspublic ItemQuery<FileSetMember> getMembers(String genericType)
FileType
. Note! The query checks the generic type from the
DataFileType.getGenericType()
, not the File.getFileType()
.
genericType
- The system ID of a generic type as defined
by FileType.getSystemId()
FileSetMember
itemspublic FileSetMember setMember(File file, DataFileType type)
DbControl.commit()
is called.
file
- The file to set as a membertype
- The type of the file
InvalidUseOfNullException
- If file or type is null
PermissionDeniedException
- If the logged in user doesn't
have write permission for this file set or use permission for the
filepublic boolean hasMember(DataFileType type)
type
- A DataFileType
object
public FileSetMember getMember(DataFileType type)
type
- A DataFileType
object
public void removeMember(DataFileType type)
DataFileMetadataReader
is associated with the file type this method will call
DataFileMetadataReader.resetMetadata(DbControl)
.
type
- A DataFileType
object
InvalidUseOfNullException
- If type is null
PermissionDeniedException
- If the logged in user
doesn't have write permission for this file setpublic void removeAllMembers()
PermissionDeniedException
- If the logged in user
doesn't have write permission for this file setpublic ItemQuery<DataFileType> getMemberTypes()
DataFileType
for all members
of this file set.
public boolean hasAllRequiredFiles()
DataFileType
that is required according to
what has been specified by the Platform
and
PlatformVariant
.
PlatformFileType.isRequired()
public ItemQuery<PlatformFileType> getMissingDataFileTypes()
public List<Throwable> validate(DbControl dc, boolean extractMetadata)
DataFileType
for each member in the file set. If more than one file type
uses the same validator or metadata reader, they will all
share the same instance. This method will not throw any errors
that have been caused by the validation process. Errors are returned
as a list of Throwable
:s and is also reported by setting the
FileSetMember.isValid()
and FileSetMember.getErrorMessage()
properties for each file.
Note! PermissionDeniedException
:s are not considered validation errors.
They are ignored and doesn't change the validation status.
InvalidRelationException
is a less severe type of exception
and can be used by a validator when the actual file it is validating
is valid but a dependent file is not. For example, a valid CEL file has
been attached to a raw bioassay, but it doesn't match the CDF file attached
to the array design. If a validator throws this exception the member status
will be set to invalid, but metadata extraction is still done.
dc
- The DbControl to use in the validation processextractMetadata
- TRUE to also extract metadata, FALSE otherwise
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |