Package net.sf.basedb.core
Class DataFileType
java.lang.Object
net.sf.basedb.core.BasicItem
net.sf.basedb.core.DataFileType
- All Implemented Interfaces:
AccessControlled
,Controlled
,Identifiable
,Nameable
,Removable
,Validatable
public class DataFileType extends BasicItem implements Nameable, Removable, Validatable
This class is used to represent types of files that are used
to hold data instead of importing the data into into the database.
- Version:
- 2.5
- Author:
- Nicklas
- Last modified
- $Date: 2019-02-26 11:10:15 +0100 (tis, 26 feb. 2019) $
-
Field Summary
Fields Modifier and Type Field Description static String
AFFYMETRIX_CDF
The external ID for the file type representing Affymetrix CDF files.static String
AFFYMETRIX_CEL
The external ID for the file type representing Affymetrix CEL files.static String
BAM
The external ID for the file type representing a BAM (Binary Sequence Alignment/Map) file.static String
BASEFILE_MATRIX
The external ID for the file type representing a matrix BASEFile.static String
BASEFILE_SERIAL
The external ID for the file type representing a serial BASEFile.static String
BFS_METADATA
The external ID for the file type representing a BFS metadata file.static String
FPKM_TRACKING
The external ID for the file type representing a FPKM tracking file.static String
GENERIC_EXTRAVALUE_DATA
The external ID for the file type representing generic analysed extra value data.static String
GENERIC_PRINT_MAP
The external ID for the file type representing a generic print map (array design layout) of any type.static String
GENERIC_RAW_DATA
The external ID for the file type representing a generic raw data file of any type.static String
GENERIC_REPORTER_MAP
The external ID for the file type representing a generic reporter map (array design layout) of any type.static String
GENERIC_SPOT_DATA
The external ID for the file type representing generic analysed spot data.static int
MAX_EXTENSION_LENGTH
The maximum length of the file extension that can be stored in the database.static int
MAX_EXTERNAL_ID_LENGTH
The maximum length of the external ID that can be stored in the database.static String
MEV_TDMS
The external ID for the file type representing a MeV TDMS (Tab-Delimited Multiple Sample) file.static String
MICROARRAY_IMAGE
The external ID for the file type representing scanned microarray image.static String
REF_SEQ_GTF
The external ID for the file type representing a GTF reference file that define the features on an array design that we are interested in.static String
SAM
The external ID for the file type representing a SAM (Sequence Alignment/Map) file.static Item
TYPE
The type of item represented by this class.Fields inherited from interface net.sf.basedb.core.Nameable
MAX_DESCRIPTION_LENGTH, MAX_NAME_LENGTH
-
Constructor Summary
Constructors Constructor Description DataFileType(DataFileTypeData data)
Creates a new filetype item from the given data. -
Method Summary
Modifier and Type Method Description static DataFileType
getByExternalId(DbControl dc, String externalId)
Get aDataFileType
item when you know the external ID.static DataFileType
getById(DbControl dc, int id)
Get aDataFileType
object when you know the ID.(package private) DataFileTypeData
getData()
Get theBasicData
object that holds all data for this item.String
getDescription()
Get the description for the item.String
getExtension()
Get the common file extension for data files of this type.String
getExternalId()
Get the external id for the data file type.ItemSubtype
getGenericType()
Get the generic file type for this data file type.ItemQuery<ItemSubtype>
getItemSubtypes()
Get a query returning the item subtypes that files of this type can be used on.Item
getItemType()
Get the type of item files of this type can be used on.String
getName()
Get the name of the item.static DataFileType
getNew(DbControl dc, String externalId, Item itemType)
Create a new data file type.ItemQuery<PlatformFileType>
getPlatforms()
Get a query that returns all platforms/variants that are using this file type.static ItemQuery<DataFileType>
getQuery()
Get a query configured to retrieveDataFileType
items.static ItemQuery<DataFileType>
getQuery(FileStoreEnabled item)
Get a query configured to retrieveDataFileType
:s that can be used on a given item.static ItemQuery<DataFileType>
getQuery(Platform platform, PlatformVariant variant, Item itemType, ItemSubtype genericType)
Get a query to retrieveDataFileType
:s that can be used on specific platform/variant for a given item and/or generic file type.User
getRemovedBy()
Get the user that flagged this item for removal.Item
getType()
Get the type of item represented by the object.Set<ItemProxy>
getUsingItems()
Get all:FileSetMember
:s using this file typePlatform
:s using this file typeItemSubtype
:s using this file typeboolean
hasActiveValidator(DbControl dc)
Check if there is at least one extension that claims to support validation of files of this type.boolean
isRemoved()
Check if the removed flag is set for this item.boolean
isUsed()
Check if: A file has been tagged with this type in a file set A platform is using this file typevoid
setDescription(String description)
Set the description for the item.void
setExtension(String extension)
Set the most common gile extension for data file of this type.private void
setExternalId(String externalId)
void
setGenericType(ItemSubtype genericType)
Set the generic file type of this item.private void
setItemType(Item itemType)
void
setName(String name)
Set the name of the item.void
setRemoved(boolean removed)
Set the removed flag for this item.Methods inherited from class net.sf.basedb.core.BasicItem
addAnnotatableParents, addUsingItems, addUsingItems, breakCircularReferences, checkBatchAnnotatableUsage, checkPermission, equals, getBasicData, getDbControl, getId, getPermissions, getPluginPermissions, getSessionControl, getVersion, hashCode, hasPermission, initPermissions, isDetached, isInDatabase, onAfterCommit, onAfterInsert, onBeforeCommit, onRollback, setDbControl, setProjectDefaults, toString, validate
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface net.sf.basedb.core.AccessControlled
checkPermission, getPermissions, hasPermission
Methods inherited from interface net.sf.basedb.core.Identifiable
getId, getVersion
-
Field Details
-
TYPE
The type of item represented by this class.- See Also:
Item.DATAFILETYPE
,getType()
-
AFFYMETRIX_CDF
The external ID for the file type representing Affymetrix CDF files.- See Also:
- Constant Field Values
-
AFFYMETRIX_CEL
The external ID for the file type representing Affymetrix CEL files.- See Also:
- Constant Field Values
-
GENERIC_RAW_DATA
The external ID for the file type representing a generic raw data file of any type.- See Also:
- Constant Field Values
-
GENERIC_REPORTER_MAP
The external ID for the file type representing a generic reporter map (array design layout) of any type.- See Also:
- Constant Field Values
-
GENERIC_PRINT_MAP
The external ID for the file type representing a generic print map (array design layout) of any type.- See Also:
- Constant Field Values
-
GENERIC_SPOT_DATA
The external ID for the file type representing generic analysed spot data.- Since:
- 2.8
- See Also:
- Constant Field Values
-
GENERIC_EXTRAVALUE_DATA
The external ID for the file type representing generic analysed extra value data.- Since:
- 2.8
- See Also:
- Constant Field Values
-
BASEFILE_SERIAL
The external ID for the file type representing a serial BASEFile.- Since:
- 2.11
- See Also:
- Constant Field Values
-
BASEFILE_MATRIX
The external ID for the file type representing a matrix BASEFile.- Since:
- 2.11
- See Also:
- Constant Field Values
-
BFS_METADATA
The external ID for the file type representing a BFS metadata file. The metadata file may reference additional files.- Since:
- 2.15
- See Also:
- Constant Field Values
-
MEV_TDMS
The external ID for the file type representing a MeV TDMS (Tab-Delimited Multiple Sample) file.- Since:
- 2.11
- See Also:
- Constant Field Values
-
SAM
The external ID for the file type representing a SAM (Sequence Alignment/Map) file.- Since:
- 3.0
- See Also:
- Constant Field Values
-
BAM
The external ID for the file type representing a BAM (Binary Sequence Alignment/Map) file.- Since:
- 3.0
- See Also:
- Constant Field Values
-
MICROARRAY_IMAGE
The external ID for the file type representing scanned microarray image.- Since:
- 3.0
- See Also:
- Constant Field Values
-
REF_SEQ_GTF
The external ID for the file type representing a GTF reference file that define the features on an array design that we are interested in.- Since:
- 3.0
- See Also:
- Constant Field Values
-
FPKM_TRACKING
The external ID for the file type representing a FPKM tracking file. http://cufflinks.cbcb.umd.edu/manual.html#tracking_format- Since:
- 3.0
- See Also:
- Constant Field Values
-
MAX_EXTENSION_LENGTH
public static final int MAX_EXTENSION_LENGTHThe maximum length of the file extension that can be stored in the database.- See Also:
setExtension(String)
, Constant Field Values
-
MAX_EXTERNAL_ID_LENGTH
public static final int MAX_EXTERNAL_ID_LENGTHThe maximum length of the external ID that can be stored in the database.- See Also:
setExternalId(String)
, Constant Field Values
-
-
Constructor Details
-
DataFileType
DataFileType(DataFileTypeData data)Creates a new filetype item from the given data.- Parameters:
data
- the data.
-
-
Method Details
-
getNew
Create a new data file type.- Parameters:
dc
- The DbControl to use for database accessexternalId
- The external ID of the new type, must be unique for all file typesitemType
- The type of item that files of this type can be attached to. The item must implement theFileStoreEnabled
interface- Returns:
- The new file set member type object
-
getById
public static DataFileType getById(DbControl dc, int id) throws ItemNotFoundException, PermissionDeniedException, BaseExceptionGet aDataFileType
object when you know the ID.- Parameters:
dc
- TheDbControl
which will be used for permission checking and database access.id
- The ID of the item to load- Returns:
- The
DataFileType
item - Throws:
ItemNotFoundException
- If an item with the specified ID is not foundPermissionDeniedException
- If the logged in user doesn't havePermission.READ
permission to the itemsBaseException
- If there is another error
-
getByExternalId
public static DataFileType getByExternalId(DbControl dc, String externalId) throws ItemNotFoundException, PermissionDeniedException, BaseExceptionGet aDataFileType
item when you know the external ID.- Parameters:
dc
- TheDbControl
which will be used for permission checking and database access.externalId
- The external ID of the item to load- Returns:
- The
DataFileType
item. - Throws:
ItemNotFoundException
- If an item with the specified ID is not foundPermissionDeniedException
- If the logged in user doesn't have read permission for the itemBaseException
- If there is another error
-
getQuery
Get a query configured to retrieveDataFileType
items.- Returns:
- An
ItemQuery
object - Throws:
BaseException
- If getting the query fails.
-
getQuery
Get a query configured to retrieveDataFileType
:s that can be used on a given item. This method will check theFileStoreEnabled.getPlatform()
andFileStoreEnabled.getVariant()
values and restrict the query to only return items that can be used for that platform. If the item isn't attached to any platform or variant all data file types for theIdentifiable.getType()
are returned.- Parameters:
item
- The item to get data file types for, or null to return all data file types- Returns:
- An
ItemQuery
object
-
getQuery
public static ItemQuery<DataFileType> getQuery(Platform platform, PlatformVariant variant, Item itemType, ItemSubtype genericType)Get a query to retrieveDataFileType
:s that can be used on specific platform/variant for a given item and/or generic file type. All parameters are optional. If all are null the result is the same asgetQuery()
.- Parameters:
platform
- The platform, or null to not restrict by platform (unless a variant is given)variant
- The platform variant, or null to not restrict by variantitemType
- The type of item it should be possible to attach file to, or null to not restrict by itemgenericType
- The generic file type, or null to not restrict by file type- Returns:
- A query returning data file types matching the specified restrictions
- Since:
- 2.9
-
getData
DataFileTypeData getData()Description copied from class:BasicItem
Get theBasicData
object that holds all data for this item. -
getType
Description copied from interface:Identifiable
Get the type of item represented by the object. The returned value is one of the values defined in theItem
enumeration.- Specified by:
getType
in interfaceIdentifiable
- Returns:
- A value indicating the type of item
-
getName
Description copied from interface:Nameable
Get the name of the item. -
setName
Description copied from interface:Nameable
Set the name of the item. The name cannot be null and mustn't be longer than the value specified by theNameable.MAX_NAME_LENGTH
constant.- Specified by:
setName
in interfaceNameable
- Parameters:
name
- The new name for the item- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permissionInvalidDataException
- If the name is null or longer than specified by theNameable.MAX_NAME_LENGTH
constant
-
getDescription
Description copied from interface:Nameable
Get the description for the item.- Specified by:
getDescription
in interfaceNameable
- Returns:
- A
String
with a description of the item
-
setDescription
public void setDescription(String description) throws PermissionDeniedException, InvalidDataExceptionDescription copied from interface:Nameable
Set the description for the item. The description can be null but mustn't be longer than the value specified by theNameable.MAX_DESCRIPTION_LENGTH
constant.- Specified by:
setDescription
in interfaceNameable
- Parameters:
description
- The new description for the item- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permissionInvalidDataException
- If the description longer than specified by theNameable.MAX_DESCRIPTION_LENGTH
constant
-
isRemoved
public boolean isRemoved()Description copied from interface:Removable
Check if the removed flag is set for this item. -
setRemoved
Description copied from interface:Removable
Set the removed flag for this item.- Specified by:
setRemoved
in interfaceRemovable
- Parameters:
removed
- TRUE if the item should be flagged as removed, FALSE otherwise- Throws:
PermissionDeniedException
- If the logged in user doesn't havePermission.DELETE
permission for setting the flag to TRUE orPermission.WRITE
permission for setting the flag to FALSE
-
getRemovedBy
Description copied from interface:Removable
Get the user that flagged this item for removal.- Specified by:
getRemovedBy
in interfaceRemovable
- Returns:
- A User object, or null if this item has not been flagged
- Throws:
PermissionDeniedException
- If the logged in user doesn't havePermission.READ
permission for the userItemNotFoundException
- If the user that removed this item can't be found
-
isUsed
Check if:- A file has been tagged with this type in a file set
- A platform is using this file type
- Overrides:
isUsed
in classBasicItem
- Returns:
- TRUE if this item is used, FALSE otherwise
- Throws:
BaseException
- If not able to tell if item is used or not.- See Also:
BasicItem.getUsingItems()
-
getUsingItems
Get all:FileSetMember
:s using this file typePlatform
:s using this file typeItemSubtype
:s using this file type
- Overrides:
getUsingItems
in classBasicItem
- Returns:
- A set containing proxies for the items, or an empty set if no items are using this item
- See Also:
BasicItem.addUsingItems(Set, Item, org.hibernate.query.Query)
-
getExternalId
Get the external id for the data file type. -
setExternalId
private void setExternalId(String externalId) throws PermissionDeniedException, InvalidDataException, BaseException -
getGenericType
Get the generic file type for this data file type.- Returns:
- A file subtype item
- Since:
- 3.0
-
setGenericType
Set the generic file type of this item. Null is not allowed.- Parameters:
genericType
- The generic file type- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permission- Since:
- 3.0
-
getExtension
Get the common file extension for data files of this type.- Returns:
- A string or null if there is no common file extension
-
setExtension
Set the most common gile extension for data file of this type.- Parameters:
extension
- The extension or null- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permissionStringTooLongException
- If the string is longer thatMAX_EXTENSION_LENGTH
.
-
setItemType
-
getItemType
Get the type of item files of this type can be used on. The item should implement theFileStoreEnabled
interface.- Returns:
- An
Item
object
-
getItemSubtypes
Get a query returning the item subtypes that files of this type can be used on. The query should only be used if the main item typegetItemType()
is aSubtypable
item.- Returns:
- A query
- Since:
- 3.0
-
hasActiveValidator
Check if there is at least one extension that claims to support validation of files of this type. The extensions are not actually invoked, only prepared.- Since:
- 3.0
-
getPlatforms
Get a query that returns all platforms/variants that are using this file type.- Returns:
- A query object
-