Package net.sf.basedb.core
Class Platform
java.lang.Object
net.sf.basedb.core.BasicItem
net.sf.basedb.core.Platform
- All Implemented Interfaces:
AccessControlled
,Identifiable
,Nameable
,Removable
This class is used to represent an experimental platform in BASE.
An experimental platform is used to define the types of files
that are used as data files. For example, the
AFFYMETRIX
platform defines CDF
and
CEL
files.
A platform may have variants. A PlatformVariant
has independent
settings but may inherit file types from the main platform.
Some platforms are file-only platforms, and has data that can't be imported
into the database, for example the Affymetrix platform. Platforms that
are not file-only can also import data into the database. Such platforms
may be locked to a single RawDataType
or they may be GENERIC
.
- Version:
- 2.5
- Author:
- Nicklas
- Last modified
- $Date: 2017-05-22 14:35:27 +0200 (må, 22 maj 2017) $
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
The external id for theAffymetrix
platform.static final String
The external id for theGeneric
platform.static final int
The maximum length of the external ID that can be stored in the database.static final String
The external id for the genericSequencing
platform.static final Item
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
ConstructorDescriptionPlatform
(PlatformData data) Creates a new filetype item from the given data. -
Method Summary
Modifier and TypeMethodDescriptionstatic Platform
getByExternalId
(DbControl dc, String externalId) Get aPlatform
item when you know the external ID.static Platform
Get aPlatform
object when you know the ID.(package private) PlatformData
getData()
Get theBasicData
object that holds all data for this item.Get the description for the item.Get the external id for the platform.getFileType
(DataFileType type, PlatformVariant variant, boolean create) Get information about a file type that has been registered with this platform/variant.getFileTypes
(PlatformVariant variant, boolean restrict) Get the file types registered with this platform.getName()
Get the name of the item.static Platform
Create a new file-only platform.static Platform
getNew
(DbControl dc, String externalId, RawDataType rawDataType) Create a new platform which may optionally import data into the database.getQuery()
Get a query configured to retrievePlatform
items.Get the raw data type this platform is locked to.Get the user that flagged this item for removal.getType()
Get the type of item represented by the object.Get all:ArrayDesign
:s andRawBioAssay
:s using this platformGet a query that returns variants of this platform.protected void
initPermissions
(int granted, int denied) Deny deletion of the GENERIC and Affymetrix platform.boolean
Check if the platform is a file-only platform or if it allows data to be imported into the database.boolean
Check if the removed flag is set for this item.boolean
isUsed()
Check if: any raw bioassays or array design are using this platformnewVariant
(String systemId) Create a newPlatformVariant
of this platform.(package private) void
onAfterCommit
(Transactional.Action action) Register file-only platforms as raw data type after insert and unregister after delete.void
removeFileType
(DataFileType type, PlatformVariant variant) Remove a file type from this platform/variant.private void
setChannels
(int channels) Set the number of channels for a file-only platform.void
setDescription
(String description) Set the description for the item.private void
setExternalId
(String externalId) void
Set the name of the item.private void
setRawDataType
(RawDataType rawDataType) Set the raw data type.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, isDetached, isInDatabase, 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:
-
GENERIC
The external id for theGeneric
platform. It allows importing raw data into the database for all raw data type. -
AFFYMETRIX
The external id for theAffymetrix
platform. It is a file-only platform. -
SEQUENCING
The external id for the genericSequencing
platform. We don't defined any specific details at this level, but use variants for this.- Since:
- 3.0
- See Also:
-
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:
-
-
Constructor Details
-
Platform
Platform(PlatformData data) Creates a new filetype item from the given data.- Parameters:
data
- the data.
-
-
Method Details
-
getNew
Create a new file-only platform. Data for this platform can't be imported to the database.- Parameters:
dc
- The DbControl to use for database accessexternalId
- The external ID of the platform, must be unique for all platformschannels
- Number of channels in this platform- Returns:
- The new platform object
-
getNew
Create a new platform which may optionally import data into the database.- Parameters:
dc
- The DbControl to use for database accessexternalId
- The external ID of the platform, must be unique for all platformsrawDataType
- A specific raw data type this platform will be locked to or null if it is not locked to any specific raw data type- Returns:
- The new platform object
-
getById
public static Platform getById(DbControl dc, int id) throws ItemNotFoundException, PermissionDeniedException, BaseException Get aPlatform
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
Platform
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 Platform getByExternalId(DbControl dc, String externalId) throws ItemNotFoundException, PermissionDeniedException, BaseException Get aPlatform
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
Platform
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 retrievePlatform
items.- Returns:
- An
ItemQuery
object - Throws:
BaseException
- If the query could not be created.
-
getData
PlatformData 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, InvalidDataException Description 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:- any raw bioassays or array design are using this platform
- 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:
-
getUsingItems
Get all:ArrayDesign
:s andRawBioAssay
:s using this platform
- 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:
-
initPermissions
protected void initPermissions(int granted, int denied) Deny deletion of the GENERIC and Affymetrix platform. The GENERIC platform is required by the system and the AFFYMETRIX platform is required for backwards compatibility reasons.- Overrides:
initPermissions
in classBasicItem
- Parameters:
granted
- Permissions that have been granted by the subclassdenied
- Permissions that have been denied by the subclass
-
onAfterCommit
Register file-only platforms as raw data type after insert and unregister after delete.- Overrides:
onAfterCommit
in classBasicItem
- Since:
- 2.16.2
- See Also:
-
getExternalId
Get the external id for the platform. -
setExternalId
private void setExternalId(String externalId) throws PermissionDeniedException, InvalidDataException, BaseException -
setChannels
private void setChannels(int channels) Set the number of channels for a file-only platform. -
setRawDataType
Set the raw data type. The raw data type must allow data to be imported into the database.- Parameters:
rawDataType
- The raw data type, null is allowed
-
isFileOnly
public boolean isFileOnly()Check if the platform is a file-only platform or if it allows data to be imported into the database.- Returns:
- TRUE if only file data is allowed, FALSE if import to database is allowed
-
getRawDataType
Get the raw data type this platform is locked to. File-only platforms are always locked to a raw data type. Platforms that support import of data to the database may or may not be locked. Note! If the variant is a file-only variant that hasn't been committed to the database a new instance ofRawDataType
is returned for each call to this method.- Returns:
- The raw data type or null if the platform isn't locked
-
getVariants
Get a query that returns variants of this platform.- Returns:
- An ItemQuery object
-
newVariant
Create a newPlatformVariant
of this platform.- Parameters:
systemId
- The systemId of the new variant (must be unique)- Returns:
- The new
PlatformVariant
object - See Also:
-
getFileTypes
Get the file types registered with this platform. -
removeFileType
Remove a file type from this platform/variant. If the file type isn't registered this method does nothing. If a variant is given the file type is only removed from that variant. If no variant is given the file type is only removed from the platform, not from other variants that have registered with the file type.- Parameters:
type
- The file type to removevariant
- An optional variant- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permissionInvalidUseOfNullException
- If type is null
-
getFileType
Get information about a file type that has been registered with this platform/variant.- Parameters:
type
- The file type to get information forvariant
- An optional variantcreate
- If TRUE, the file type will be added to the platform if it doesn't already exists- Returns:
- Null if the file type isn't registered with the platform/variant (and create is false)
or a
PlatformFileType
object - Since:
- 3.0
-