public abstract class Setting extends BasicItem
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.
Modifier and Type | Field and Description |
---|---|
static int |
MAX_NAME_LENGTH
The maximum length of the name that can be stored in the
database.
|
static int |
MAX_VALUE_LENGTH
The maximum length of the value that can be stored in the
database.
|
static Item |
TYPE
The type of item represented by this class.
|
Constructor and Description |
---|
Setting(SettingData settingData) |
Modifier and Type | Method and Description |
---|---|
static Setting |
getById(DbControl dc,
int id)
Get a
Setting item when you know the ID. |
(package private) SettingData |
getData()
Get the
BasicData object that holds all data for this item. |
String |
getName()
Get the name of this setting.
|
String |
getValue()
Get the value of this setting.
|
(package private) void |
initPermissions(int granted,
int denied)
Add permissions granted to
Item.SETTING . |
void |
setName(String name)
Set the name for this setting.
|
void |
setValue(String value)
Set the value for this setting.
|
addUsingItems, addUsingItems, checkPermission, equals, getBasicData, getDbControl, getId, getPermissions, getPluginPermissions, getSessionControl, getUsingItems, getVersion, hashCode, hasPermission, isDetached, isInDatabase, isUsed, onAfterCommit, onAfterInsert, onBeforeCommit, onRollback, setDbControl, setProjectDefaults, toString, validate
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getType
public static final Item TYPE
Item.SETTING
,
Identifiable.getType()
public static final int MAX_NAME_LENGTH
setName(String)
method to avoid exceptions.public static final int MAX_VALUE_LENGTH
setValue(String)
method to avoid exceptions.Setting(SettingData settingData)
public static Setting getById(DbControl dc, int id) throws ItemNotFoundException, PermissionDeniedException, BaseException
Setting
item when you know the ID.dc
- The DbControl
which will be used for
permission checking and database access.id
- The ID of the item to loadSetting
itemItemNotFoundException
- If an item with the specified
ID is not foundPermissionDeniedException
- If the logged in user doesn't
have Permission.READ
permission to the itemBaseException
- If there is another errorSettingData getData()
BasicItem
BasicData
object that holds all data for this item.void initPermissions(int granted, int denied) throws BaseException
Item.SETTING
.initPermissions
in class BasicItem
granted
- Permissions that have been granted by the subclassdenied
- Permissions that have been denied by the subclassBaseException
- If the permissions couldn't be initialisedpublic String getName()
public void setName(String name) throws PermissionDeniedException, InvalidDataException
name
- Name to be set.PermissionDeniedException
- If the logged in user doesn't have
write permissionInvalidDataException
- If the new name is longer than
MAX_NAME_LENGTH
public String getValue()
public void setValue(String value) throws PermissionDeniedException, InvalidDataException
value
- The string value to be set. Can not be longer then 65535PermissionDeniedException
- If the logged in user doesn't have
write permissionInvalidDataException
- If the new value is longer than
MAX_VALUE_LENGTH