Package net.sf.basedb.core
Class PlatformVariant
java.lang.Object
net.sf.basedb.core.BasicItem
net.sf.basedb.core.BasicChildItem
net.sf.basedb.core.PlatformVariant
- All Implemented Interfaces:
AccessControlled
,Identifiable
,Nameable
,Removable
Represents variants of a
Platform
.- 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 int
The maximum length of the external ID that can be stored in the database.private static final QueryRuntimeFilter
This filter will only return items if the logged in user has generic read permission to platforms.static final String
The external id for the expression-like sequencing data.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
ConstructorDescriptionCreates a new filetype item from the given data. -
Method Summary
Modifier and TypeMethodDescriptionstatic PlatformVariant
getByExternalId
(DbControl dc, String externalId) Get aPlatformVariant
item when you know the external ID.static PlatformVariant
Get aPlatformVariant
object when you know the ID.(package private) PlatformVariantData
getData()
Get theBasicData
object that holds all data for this item.Get the description for the item.Get the external id for the platform variant.getFileTypes
(boolean restrict) Get a query returning file types registered with this platform variant.getName()
Get the name of the item.static PlatformVariant
Create a new variant of a platform.static PlatformVariant
Create a new file-only variant of a platform.static PlatformVariant
getNew
(DbControl dc, Platform platform, String externalId, RawDataType rawDataType) Create a new platform variant which may optionally import data into the database.(package private) Item
Get the type of item that is the parent of this item.Get that platform this is a variant of.static ItemQuery<PlatformVariant>
getQuery()
Get a query configured to retrievePlatformVariant
items.Get the raw data type this platform variant 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 platform variantboolean
Check if the platform variant is a file-only variant 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 platform variant(package private) void
onAfterCommit
(Transactional.Action action) Register file-only platforms as raw data type after insert and unregister after delete.private void
setChannels
(int channels) Set the number of channels for a file-only platform variant.void
setDescription
(String description) Set the description for the item.private void
setExternalId
(String externalId) void
Set the name of the item.private void
setPlatform
(Platform platform) 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.BasicChildItem
getPermissionForWriteDeleteAndCreate, getPluginPermissions, initPermissions
Methods inherited from class net.sf.basedb.core.BasicItem
addAnnotatableParents, addUsingItems, addUsingItems, breakCircularReferences, checkBatchAnnotatableUsage, checkPermission, equals, getBasicData, getDbControl, getId, getPermissions, 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
-
SEQUENCING_EXPRESSION
The external id for the expression-like sequencing data.- Since:
- 3.0
- See Also:
-
TYPE
The type of item represented by this class.- See Also:
-
RUNTIME_FILTER
This filter will only return items if the logged in user has generic read permission to platforms. -
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
-
PlatformVariant
PlatformVariant(PlatformVariantData data) Creates a new filetype item from the given data.- Parameters:
data
- the data.
-
-
Method Details
-
getNew
Create a new variant of a platform. If the platform is a file-only platform the new variant will also be a file-only variant.- Parameters:
dc
- The DbControl to use for database accessplatform
- The platform to create a variant forexternalId
- The external ID of the variant, it must be unique for all variants- Returns:
- The new PlatformVariant item
-
getNew
public static PlatformVariant getNew(DbControl dc, Platform platform, String externalId, int channels) Create a new file-only variant of a platform. Data for this variant can't be imported to the database.- Parameters:
dc
- The DbControl to use for database accessplatform
- The platform to create a variant forexternalId
- The external ID of the variant, it must be unique for all variantschannels
- Number of channels in this variant- Returns:
- The new variant object
-
getNew
public static PlatformVariant getNew(DbControl dc, Platform platform, String externalId, RawDataType rawDataType) Create a new platform variant which may optionally import data into the database.- Parameters:
dc
- The DbControl to use for database accessplatform
- The platform to create a variant forexternalId
- The external ID of the platform variant, must be unique for all variants (including those for other platforms)rawDataType
- 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 PlatformVariant getById(DbControl dc, int id) throws ItemNotFoundException, PermissionDeniedException, BaseException Get aPlatformVariant
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
PlatformVariant
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 PlatformVariant getByExternalId(DbControl dc, String externalId) throws ItemNotFoundException, PermissionDeniedException, BaseException Get aPlatformVariant
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
PlatformVariant
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 retrievePlatformVariant
items.- Returns:
- An
ItemQuery
object - Throws:
BaseException
- If the query could not be created.
-
getData
PlatformVariantData 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 variant
- 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 variant
- 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:
-
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:
-
getParentType
Item getParentType()Description copied from class:BasicChildItem
Get the type of item that is the parent of this item.- Specified by:
getParentType
in classBasicChildItem
- Returns:
- The item type of the parent item
-
getPlatform
Get that platform this is a variant of.- Returns:
- A
Platform
item - Throws:
PermissionDeniedException
- If the logged in user doesn't have read permission to the item
-
setPlatform
-
getExternalId
Get the external id for the platform variant. -
setExternalId
private void setExternalId(String externalId) throws PermissionDeniedException, InvalidDataException, BaseException -
isFileOnly
public boolean isFileOnly()Check if the platform variant is a file-only variant 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
-
setChannels
private void setChannels(int channels) Set the number of channels for a file-only platform variant. -
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
-
getRawDataType
Get the raw data type this platform variant is locked to. File-only variants are always locked to a raw data type. Variants 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
-
getFileTypes
Get a query returning file types registered with this platform variant.- Parameters:
restrict
- If TRUE the query will only return file types that has been directly registered with this variant, if FALSE the query will also return file types that have been registered with the platform- See Also:
-