2.17.2: 2011-06-17

net.sf.basedb.core
Interface Nameable

All Superinterfaces:
AccessControlled, Identifiable
All Known Implementing Classes:
AnnotatedItem, AnnotationType, AnnotationTypeCategory, AnyToAny, ArrayBatch, ArrayDesign, ArraySlide, BioAssay, BioAssaySet, BioMaterial, BioMaterialList, BioPlate, BioPlateEvent, BioPlateEventType, BioPlateType, BioSource, Client, CommonItem, DataFileType, Directory, Experiment, Extract, ExtraValueType, File, FileServer, FileType, Formula, Group, Hardware, HardwareType, Help, Hybridization, Image, Job, JobAgent, Label, LabeledExtract, MeasuredBioMaterial, Message, MimeType, NameablePluginAdaptor, News, PermissionTemplate, Plate, PlateEventType, PlateGeometry, PlateMapping, PlateType, Platform, PlatformVariant, PluginConfiguration, PluginDefinition, PluginType, Project, Protocol, ProtocolType, Quantity, Quota, QuotaType, RawBioAssay, ReporterList, ReporterType, Role, RoleKey, Sample, Scan, Software, SoftwareType, Transformation, Unit, User

public interface Nameable
extends Identifiable

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:
NameableUtil
Last modified
$Date: 2009-04-06 14:52:39 +0200 (Mon, 06 Apr 2009) $

Field Summary
static int MAX_DESCRIPTION_LENGTH
          The maximum length of the description.
static int MAX_NAME_LENGTH
          The maximum length of the name of the item that can be stored in the database.
 
Method Summary
 String getDescription()
          Get the description for the item.
 String getName()
          Get the name of the item.
 void setDescription(String description)
          Set the description for the item.
 void setName(String name)
          Set the name of the item.
 
Methods inherited from interface net.sf.basedb.core.Identifiable
getId, getType, getVersion
 
Methods inherited from interface net.sf.basedb.core.AccessControlled
checkPermission, getPermissions, hasPermission
 

Field Detail

MAX_NAME_LENGTH

static final int MAX_NAME_LENGTH
The maximum length of the name of the item that can be stored in the database. Check the name length against this value before calling the setName(String) method to avoid exceptions.

See Also:
setName(String), Constant Field Values

MAX_DESCRIPTION_LENGTH

static final int MAX_DESCRIPTION_LENGTH
The maximum length of the description. Check the description length against this value before calling the setDescription(String) method to avoid exceptions.

See Also:
setDescription(String), Constant Field Values
Method Detail

getName

String getName()
Get the name of the item.

Returns:
A String with the name of the item

setName

void setName(String name)
             throws PermissionDeniedException,
                    InvalidDataException
Set the name of the item. The name cannot be null and mustn't be longer than the value specified by the MAX_NAME_LENGTH constant.

Parameters:
name - The new name for the item
Throws:
PermissionDeniedException - If the logged in user doesn't have write permission
InvalidDataException - If the name is null or longer than specified by the MAX_NAME_LENGTH constant

getDescription

String getDescription()
Get the description for the item.

Returns:
A String with a description of the item

setDescription

void setDescription(String description)
                    throws PermissionDeniedException,
                           InvalidDataException
Set the description for the item. The description can be null but mustn't be longer than the value specified by the MAX_DESCRIPTION_LENGTH constant.

Parameters:
description - The new description for the item
Throws:
PermissionDeniedException - If the logged in user doesn't have write permission
InvalidDataException - If the description longer than specified by the MAX_DESCRIPTION_LENGTH constant

2.17.2: 2011-06-17