|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Nameable
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); }
NameableUtil
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 |
---|
static final int MAX_NAME_LENGTH
setName(String)
method to avoid exceptions.
setName(String)
,
Constant Field Valuesstatic final int MAX_DESCRIPTION_LENGTH
setDescription(String)
method to avoid exceptions.
setDescription(String)
,
Constant Field ValuesMethod Detail |
---|
String getName()
String
with the name of the itemvoid setName(String name) throws PermissionDeniedException, InvalidDataException
MAX_NAME_LENGTH
constant.
name
- The new name for the item
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
constantString getDescription()
String
with a description of the itemvoid setDescription(String description) throws PermissionDeniedException, InvalidDataException
MAX_DESCRIPTION_LENGTH
constant.
description
- The new description for the item
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 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |