Package net.sf.basedb.core
Class Setting
java.lang.Object
net.sf.basedb.core.BasicItem
net.sf.basedb.core.Setting
- All Implemented Interfaces:
AccessControlled
,Identifiable
- Direct Known Subclasses:
ClientDefaultSetting
,GlobalDefaultSetting
,UserClientSetting
,UserDefaultSetting
This is the base class for all setting items. There are
four types of settings:
UserClientSetting
: Specific for a user using a client application.UserDefaultSetting
: Specific for a user, valid for all client applications.ClientDefaultSetting
: Specific for a client application, valid for all users.GlobalDefaultSetting
: Valid for all users and client applications.
- Version:
- 2.0
- Author:
- Nicklas
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The maximum length of the name that can be stored in the database.static final int
The maximum length of the value that can be stored in the database.static final Item
The type of item represented by this class. -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Setting
Get aSetting
item when you know the ID.(package private) SettingData
getData()
Get theBasicData
object that holds all data for this item.getName()
Get the name of this setting.getValue()
Get the value of this setting.(package private) void
initPermissions
(int granted, int denied) Add permissions granted toItem.SETTING
.void
Set the name for this setting.void
Set the value for this setting.Methods inherited from class net.sf.basedb.core.BasicItem
addAnnotatableParents, addUsingItems, addUsingItems, breakCircularReferences, checkBatchAnnotatableUsage, checkPermission, equals, getBasicData, getDbControl, getId, getPermissions, getPluginPermissions, getSessionControl, getUsingItems, getVersion, hashCode, hasPermission, isDetached, isInDatabase, isUsed, onAfterCommit, 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.Identifiable
getType
-
Field Details
-
TYPE
The type of item represented by this class.- See Also:
-
MAX_NAME_LENGTH
public static final int MAX_NAME_LENGTHThe maximum length of the name that can be stored in the database. Check the length against this value before calling thesetName(String)
method to avoid exceptions.- See Also:
-
MAX_VALUE_LENGTH
public static final int MAX_VALUE_LENGTHThe maximum length of the value that can be stored in the database. Check the length against this value before calling thesetValue(String)
method to avoid exceptions.- See Also:
-
-
Constructor Details
-
Setting
Setting(SettingData settingData)
-
-
Method Details
-
getById
public static Setting getById(DbControl dc, int id) throws ItemNotFoundException, PermissionDeniedException, BaseException Get aSetting
item 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
Setting
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 itemBaseException
- If there is another error
-
getData
SettingData getData()Description copied from class:BasicItem
Get theBasicData
object that holds all data for this item. -
initPermissions
Add permissions granted toItem.SETTING
.- Overrides:
initPermissions
in classBasicItem
- Parameters:
granted
- Permissions that have been granted by the subclassdenied
- Permissions that have been denied by the subclass- Throws:
BaseException
- If the permissions couldn't be initialised
-
getName
Get the name of this setting.- Returns:
- A String object.
-
setName
Set the name for this setting.- Parameters:
name
- Name to be set.- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permissionInvalidDataException
- If the new name is longer thanMAX_NAME_LENGTH
-
getValue
Get the value of this setting.- Returns:
- A String object.
-
setValue
Set the value for this setting.- Parameters:
value
- The string value to be set. Can not be longer then 65535- Throws:
PermissionDeniedException
- If the logged in user doesn't have write permissionInvalidDataException
- If the new value is longer thanMAX_VALUE_LENGTH
-