Package net.sf.basedb.core
Interface Nameable
- All Superinterfaces:
AccessControlled
,Identifiable
- All Known Subinterfaces:
Listable
- All Known Implementing Classes:
AnnotatedItem
,AnnotationType
,AnnotationTypeCategory
,AnyToAny
,ArrayBatch
,ArrayDesign
,ArraySlide
,BioAssay
,BioAssaySet
,BioMaterial
,BioPlate
,BioPlateEvent
,BioPlateEventType
,BioPlateType
,BioSource
,Client
,CommonItem
,DataFileType
,DerivedBioAssay
,Directory
,Experiment
,Extract
,ExtraValueType
,File
,FileServer
,Formula
,Group
,Hardware
,Help
,ItemList
,ItemSubtype
,Job
,JobAgent
,Kit
,MeasuredBioMaterial
,Message
,MimeType
,News
,PermissionTemplate
,PhysicalBioAssay
,Plate
,PlateEventType
,PlateGeometry
,PlateMapping
,PlateType
,Platform
,PlatformVariant
,PluginConfiguration
,PluginDefinition
,PluginType
,Project
,Protocol
,Quantity
,Quota
,QuotaType
,RawBioAssay
,ReporterCloneTemplate
,ReporterList
,ReporterType
,Role
,RoleKey
,RootRawBioAssay
,Sample
,Software
,SyncFilter
,Tag
,Transformation
,Unit
,User
,UserDevice
A
Nameable
item is an item that has
a name
and description
.
The NameableUtil
class provides methods that
includes data validation to make it easy to implement
this interface.
Reference implementation
public String getName() { return getData().getName(); } public void setName(String name) throws PermissionDeniedException, InvalidDataException { checkPermission(Permission.WRITE); NameableUtil.setName(getData(), name); } public String getDescription() { return getData().getDescription(); } public void setDescription(String description) throws PermissionDeniedException, InvalidDataException { checkPermission(Permission.RESTRICTED_WRITE); NameableUtil.setDescription(getData(), description); }
- Version:
- 2.0
- Author:
- Nicklas
- See Also:
- Last modified
- $Date: 2009-04-06 14:52:39 +0200 (må, 06 apr 2009) $
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The maximum length of the description.static final int
The maximum length of the name of the item that can be stored in the database. -
Method Summary
Modifier and TypeMethodDescriptionGet the description for the item.getName()
Get the name of the item.void
setDescription
(String description) Set the description for the item.void
Set the name of the item.Methods inherited from interface net.sf.basedb.core.AccessControlled
checkPermission, getPermissions, hasPermission
Methods inherited from interface net.sf.basedb.core.Identifiable
getId, getType, getVersion
-
Field Details
-
MAX_NAME_LENGTH
static final int MAX_NAME_LENGTHThe maximum length of the name of the item that can be stored in the database. Check the name length against this value before calling thesetName(String)
method to avoid exceptions.- See Also:
-
MAX_DESCRIPTION_LENGTH
static final int MAX_DESCRIPTION_LENGTHThe maximum length of the description. Check the description length against this value before calling thesetDescription(String)
method to avoid exceptions.- See Also:
-
-
Method Details
-
getName
String getName()Get the name of the item.- Returns:
- A
String
with the name of the item
-
setName
Set the name of the item. The name cannot be null and mustn't be longer than the value specified by theMAX_NAME_LENGTH
constant.- 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 theMAX_NAME_LENGTH
constant
-
getDescription
String getDescription()Get the description for the item.- Returns:
- A
String
with a description of the item
-
setDescription
Set the description for the item. The description can be null but mustn't be longer than the value specified by theMAX_DESCRIPTION_LENGTH
constant.- 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 theMAX_DESCRIPTION_LENGTH
constant
-