Package net.sf.basedb.core
Enum Item
- java.lang.Object
-
- java.lang.Enum<Item>
-
- net.sf.basedb.core.Item
-
- All Implemented Interfaces:
Serializable
,Comparable<Item>
public enum Item extends Enum<Item>
This class defines constants for various items in BASE.- Version:
- 2.0
- Author:
- Samuel
- Last modified
- $Date: 2019-03-11 12:51:33 +0100 (mån, 11 mars 2019) $
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
Item.DefinedPermissions
Helper class to make it easier to set up the defined permissions.
-
Enum Constant Summary
-
Field Summary
Fields Modifier and Type Field Description private String
alias
private static Map<String,Item>
aliasMapping
private Constructor<? extends BasicItem>
constructor
private Class<? extends BasicData>
dataClass
private static Map<Class<? extends BasicData>,Item>
dataClassMapping
private Set<Permission>
definedPermissions
static Comparator<Identifiable>
DELETION_ORDER
private float
deletionOrder
private String
displayValue
private Method
getById
private Method
getQuery
private Class<? extends BasicItem>
itemClass
private static Map<Class<? extends BasicItem>,Item>
itemClassMapping
(package private) static int
MAX_VALUE
private int
value
private static Map<Integer,Item>
valueMapping
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Item
fromClass(Class<?> anyClass)
Get theItem
object when you know either the item or data class.static Item
fromDataClass(Class<? extends BasicData> dataClass)
Get theItem
object when you know the data class.static Item
fromDataObject(BasicData data)
Get theItem
object when you have a data layer object.static Item
fromItemClass(Class<? extends BasicItem> itemClass)
Get theItem
object when you know the item class.static Item
fromValue(int value)
Get theItem
object when you know the integer code.String
getAlias()
Get the alias for this item, which is used in queries,<T extends BasicItem>
TgetById(DbControl dc, int id)
Get the item of the type represented by this enumeration constant with the specified id.(package private) <T extends BasicItem>
Constructor<T>getConstructor()
Get the default constructor for new objects of this type.Class<? extends BasicData>
getDataClass()
Get the data object that is used to store information in the database for items of this type.Set<Permission>
getDefinedPermissions()
Get the permissions which are meaningful to assign to an item if this type.float
getDeletionOrder()
Get a value indicating the deletion order.Class<? extends BasicItem>
getItemClass()
Get the class object that is used to handle items of this type.<T extends BasicItem>
ItemQuery<T>getQuery()
Get a query returning items of this type.int
getValue()
Get the integer value that is used when storing an item to the database.boolean
isBasicItem()
Is this item representing a BasicItem object or not?boolean
supportsGetQuery()
Check ifgetQuery()
is supported by this item type.String
toString()
static Item
valueOf(String name)
Returns the enum constant of this type with the specified name.static Item[]
values()
Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
SYSTEM
public static final Item SYSTEM
Not an item as susch. Used for setting system permissions to role keys.
-
PROJECTKEY
public static final Item PROJECTKEY
The item is aProjectKey
.
-
PERMISSIONTEMPLATE
public static final Item PERMISSIONTEMPLATE
The item is aPermissionTemplate
.
-
GLOBALDEFAULTSETTING
public static final Item GLOBALDEFAULTSETTING
The item is anGlobalDefaultSetting
.
-
USERDEFAULTSETTING
public static final Item USERDEFAULTSETTING
The item is anUserDefaultSetting
.
-
CLIENTDEFAULTSETTING
public static final Item CLIENTDEFAULTSETTING
The item is anClientDefaultSetting
.
-
USERCLIENTSETTING
public static final Item USERCLIENTSETTING
The item is anUserClientSetting
.
-
USERDEVICE
public static final Item USERDEVICE
The item is anUserDevice
.
-
FILESERVER
public static final Item FILESERVER
The item is aFileServer
.
-
SYNCFILTER
public static final Item SYNCFILTER
The item is aSyncFilter
-
CHANGEHISTORY
public static final Item CHANGEHISTORY
The item is aChangeHistory
entry.
-
CHANGEHISTORY_VALUES
public static final Item CHANGEHISTORY_VALUES
Virtual item representing the new and old values column inChangeHistory
which need special access permissions.
-
ITEMSUBTYPE
public static final Item ITEMSUBTYPE
The item is aItemSubtype
.
-
ITEMSUBTYPEFILETYPE
public static final Item ITEMSUBTYPEFILETYPE
The item is aItemSubtypeFileType
-
REPORTERTYPE
public static final Item REPORTERTYPE
The item is aReporterType
.
-
REPORTERLIST
public static final Item REPORTERLIST
The item is aReporterType
.
-
REPORTERSCORE
public static final Item REPORTERSCORE
The item is aReporterScore
. This item is not a BasicItem.
-
REPORTERCLONETEMPLATE
public static final Item REPORTERCLONETEMPLATE
The item is aReporterCloneTemplate
.- Since:
- 3.1
-
ANNOTATIONSET
public static final Item ANNOTATIONSET
The item is anAnnotationSet
.
-
ANNOTATION
public static final Item ANNOTATION
The item is anAnnotation
.
-
ANNOTATIONTYPE
public static final Item ANNOTATIONTYPE
The item is anAnnotationType
.
-
ANNOTATIONTYPECATEGORY
public static final Item ANNOTATIONTYPECATEGORY
The item is anAnnotationTypeCategory
.
-
BIOMATERIALEVENT
public static final Item BIOMATERIALEVENT
The item is aBioMaterialEvent
.
-
BIOPLATETYPE
public static final Item BIOPLATETYPE
The item is aBioPlateType
.- Since:
- 2.16
-
BIOPLATEEVENT
public static final Item BIOPLATEEVENT
The item is aBioPlateEvent
- Since:
- 2.17
-
BIOPLATEEVENTPARTICIPANT
public static final Item BIOPLATEEVENTPARTICIPANT
The item is aBioPlateEventParticipant
- Since:
- 2.17
-
BIOPLATEEVENTTYPE
public static final Item BIOPLATEEVENTTYPE
The item is aBioPlateEventType
- Since:
- 2.17
-
PLATEGEOMETRY
public static final Item PLATEGEOMETRY
The item is aPlateGeometry
.
-
PLATEEVENT
public static final Item PLATEEVENT
The item is aPlateEvent
.
-
PLATEEVENTTYPE
public static final Item PLATEEVENTTYPE
The item is aPlateEventType
.
-
PLATEMAPPING
public static final Item PLATEMAPPING
The item is aPlateMapping
.
-
ARRAYDESIGN
public static final Item ARRAYDESIGN
The item is anArrayDesign
.
-
ARRAYBATCH
public static final Item ARRAYBATCH
The item is anArrayBatch
.
-
ARRAYSLIDE
public static final Item ARRAYSLIDE
The item is anArraySlide
.
-
ARRAYDESIGNBLOCK
public static final Item ARRAYDESIGNBLOCK
The item is anArrayDesignBlock
.
-
ARRAYDESIGNPLATE
public static final Item ARRAYDESIGNPLATE
The item is aArrayDesignPlate
connecter.
-
PHYSICALBIOASSAY
public static final Item PHYSICALBIOASSAY
The item is aPhysicalBioAssay
.
-
DERIVEDBIOASSAY
public static final Item DERIVEDBIOASSAY
The item is aDerivedBioAssay
.
-
RAWBIOASSAY
public static final Item RAWBIOASSAY
The item is aRawBioAssay
.
-
ROOTRAWBIOASSAY
public static final Item ROOTRAWBIOASSAY
The item is aRootRawBioAssay
.- Since:
- 3.6
-
PLUGINTYPE
public static final Item PLUGINTYPE
The item is aPluginType
-
PLUGINDEFINITION
public static final Item PLUGINDEFINITION
The item is aPluginDefinition
-
PLUGINCONFIGURATION
public static final Item PLUGINCONFIGURATION
The item is aPluginConfiguration
-
JOBAGENTSETTINGS
public static final Item JOBAGENTSETTINGS
The item is aJobAgentSettings
-
EXPERIMENT
public static final Item EXPERIMENT
The item is anExperiment
-
BIOASSAYSET
public static final Item BIOASSAYSET
The item is aBioAssaySet
-
TRANSFORMATION
public static final Item TRANSFORMATION
The item is aTransformation
-
EXTRAVALUETYPE
public static final Item EXTRAVALUETYPE
The item is anExtraValueType
-
EXTRAVALUE
public static final Item EXTRAVALUE
The item is anExtraValue
-
SPOTDATA
public static final Item SPOTDATA
Representing spot data, not an actual item.
-
DATACUBELAYER
public static final Item DATACUBELAYER
The item is aDataCubeLayer
-
DATACUBECOLUMN
public static final Item DATACUBECOLUMN
The item is aDataCubeColumn
-
DATACUBEFILTER
public static final Item DATACUBEFILTER
The item is aDataCubeFilter
-
DATACUBEEXTRAVALUE
public static final Item DATACUBEEXTRAVALUE
The item is aDataCubeExtraValue
-
PLATFORMVARIANT
public static final Item PLATFORMVARIANT
The item is aPlatformVariant
-
PLATFORMFILETYPE
public static final Item PLATFORMFILETYPE
The item is aPlatformFileType
-
FILESETMEMBER
public static final Item FILESETMEMBER
The item is aFileSetMember
-
DATAFILETYPE
public static final Item DATAFILETYPE
The item is aDataFileType
-
-
Field Detail
-
MAX_VALUE
static int MAX_VALUE
-
value
private final int value
-
displayValue
private final String displayValue
-
alias
private final String alias
-
definedPermissions
private final Set<Permission> definedPermissions
-
getById
private final transient Method getById
-
getQuery
private final transient Method getQuery
-
constructor
private final transient Constructor<? extends BasicItem> constructor
-
deletionOrder
private final float deletionOrder
-
DELETION_ORDER
public static final Comparator<Identifiable> DELETION_ORDER
-
-
Method Detail
-
values
public static Item[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (Item c : Item.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static Item valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name
- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null
-
getValue
public int getValue()
Get the integer value that is used when storing an item to the database.
-
getAlias
public String getAlias()
Get the alias for this item, which is used in queries,- See Also:
Query.getRootAlias()
-
isBasicItem
public boolean isBasicItem()
Is this item representing a BasicItem object or not? Some items only have data-layer representation and require special handling.- Since:
- 3.2
-
getItemClass
public Class<? extends BasicItem> getItemClass()
Get the class object that is used to handle items of this type.
-
getDataClass
public Class<? extends BasicData> getDataClass()
Get the data object that is used to store information in the database for items of this type.
-
getDefinedPermissions
public Set<Permission> getDefinedPermissions()
Get the permissions which are meaningful to assign to an item if this type. This is not used internally by the core, but is can be used by client applications to dynamically display a proper input form while assigning permissions.- Returns:
- A
Set
containing the permissions
-
getDeletionOrder
public float getDeletionOrder()
Get a value indicating the deletion order. Items with a low value should be deleted before items with a high value, to minimize the risk that theBasicItem.isUsed()
method returns true.- Returns:
- The deletion order value
- Since:
- 2.4
-
getById
public <T extends BasicItem> T getById(DbControl dc, int id) throws ItemNotFoundException, PermissionDeniedException, BaseException
Get the item of the type represented by this enumeration constant with the specified id. Ie.Item.SAMPLE.getById()
is the same asSample.getById
.- Parameters:
dc
- TheDbControl
object used for database access and permission checkingid
- The id of the item- Returns:
- An item of the type represented by this enumeration constant
- Throws:
ItemNotFoundException
- If an item with the specified id isn't foundPermissionDeniedException
- If the logged in user hasn't read permission for the itemBaseException
- If there is another error
-
supportsGetQuery
public boolean supportsGetQuery()
Check ifgetQuery()
is supported by this item type.- Since:
- 3.5
-
getQuery
public <T extends BasicItem> ItemQuery<T> getQuery()
Get a query returning items of this type. This method is supported by items that declare a static parameterlessgetQuery()
method in their item class (eg.Sample.getQuery()
.- Since:
- 3.5
-
getConstructor
<T extends BasicItem> Constructor<T> getConstructor()
Get the default constructor for new objects of this type. The default constructor is a constructor that takes aBasicData
object as the only parameter. For exampleSample(SampleData data)
.- Returns:
- The constructor, or null if no such constructor exists
- See Also:
DbControl.getItem(Class, BasicData, Object[])
-
fromValue
public static Item fromValue(int value)
Get theItem
object when you know the integer code.- Parameters:
value
- Integer code- Returns:
- an Item enumeration.
-
fromItemClass
public static Item fromItemClass(Class<? extends BasicItem> itemClass)
Get theItem
object when you know the item class.- Parameters:
itemClass
- Item class for whichItem
object should be returned- Returns:
- an Item enumeration.
-
fromDataClass
public static Item fromDataClass(Class<? extends BasicData> dataClass)
Get theItem
object when you know the data class.- Parameters:
dataClass
- Data class for which the Item should be returned.- Returns:
- an Item enumeration.
-
fromClass
public static Item fromClass(Class<?> anyClass)
Get theItem
object when you know either the item or data class.- Parameters:
anyClass
- The class to get correspondingItem
for.- Returns:
- The Item object, or null if no matching item is found
-
fromDataObject
public static Item fromDataObject(BasicData data)
Get theItem
object when you have a data layer object. This method takes Hibernate proxies into account.- Parameters:
data
- The data layer object for which correspondingItem
should be returned.- Returns:
- The Item object, or null if no matching item is found.
-
-