Package net.sf.basedb.core
Class ClientDefaultSetting
- java.lang.Object
-
- net.sf.basedb.core.BasicItem
-
- net.sf.basedb.core.Setting
-
- net.sf.basedb.core.ClientDefaultSetting
-
- All Implemented Interfaces:
AccessControlled
,Identifiable
public class ClientDefaultSetting extends Setting
This class is used to represent a setting for specific client application.- Version:
- 2.0
- Author:
- Nicklas
-
-
Field Summary
Fields Modifier and Type Field Description private static QueryRuntimeFilter
RUNTIME_FILTER
This filter will only return items if the logged in user has generic read permission to clients.static Item
TYPE
The type of item represented by this class.-
Fields inherited from class net.sf.basedb.core.Setting
MAX_NAME_LENGTH, MAX_VALUE_LENGTH
-
-
Constructor Summary
Constructors Constructor Description ClientDefaultSetting(ClientDefaultSettingData data)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ClientDefaultSetting
getById(DbControl dc, int id)
Get aClientDefaultSetting
item when you know the ID.Client
getClient()
Get the client application this setting is valid for.(package private) ClientDefaultSettingData
getData()
Get theBasicData
object that holds all data for this item.static ClientDefaultSetting
getNew(DbControl dc, Client client, String name, String value)
Create a newClientDefaultSetting
item.static ItemQuery<ClientDefaultSetting>
getQuery(Client client)
Get a query object configured to retrieve default settings for the specified client application.Item
getType()
Get the type of item represented by the object.(package private) void
initPermissions(int granted, int denied)
READ permission is granted if the logged in user has READ permission to the client application.(package private) void
setClient(Client client)
Set the client application this setting is valid for.-
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
-
-
-
-
Field Detail
-
TYPE
public static final Item TYPE
The type of item represented by this class.- See Also:
Item.CLIENTDEFAULTSETTING
,getType()
-
RUNTIME_FILTER
private static final QueryRuntimeFilter RUNTIME_FILTER
This filter will only return items if the logged in user has generic read permission to clients.
-
-
Constructor Detail
-
ClientDefaultSetting
ClientDefaultSetting(ClientDefaultSettingData data)
-
-
Method Detail
-
getNew
public static ClientDefaultSetting getNew(DbControl dc, Client client, String name, String value) throws BaseException
Create a newClientDefaultSetting
item.- Parameters:
dc
- TheDbControl
which will be used for permission checking and database accessclient
- TheClient
which this should be a default setting forname
- The name of the settingvalue
- The value of the setting- Returns:
- The new
ClientDefaultSetting
item - Throws:
BaseException
- If there is an error- See Also:
Client.newDefaultSetting(String,String)
-
getById
public static ClientDefaultSetting getById(DbControl dc, int id) throws ItemNotFoundException, PermissionDeniedException, BaseException
Get aClientDefaultSetting
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
ClientDefaultSetting
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
-
getQuery
public static ItemQuery<ClientDefaultSetting> getQuery(Client client)
Get a query object configured to retrieve default settings for the specified client application.- Parameters:
client
- The client to retreive settings for, null is allowed if the logged in user has generic READ permission for clients in which case all settings will be returned- Returns:
- An
ItemQuery
object - See Also:
Client.getDefaultSettings()
-
getData
ClientDefaultSettingData getData()
Description copied from class:BasicItem
Get theBasicData
object that holds all data for this item.
-
getType
public Item getType()
Description copied from interface:Identifiable
Get the type of item represented by the object. The returned value is one of the values defined in theItem
enumeration.- Returns:
- A value indicating the type of item
-
initPermissions
void initPermissions(int granted, int denied) throws BaseException
READ permission is granted if the logged in user has READ permission to the client application. WRITE, DELETE and CREATE permissions are granted if the logged in user have WRITE permission to the client application of this setting.- Overrides:
initPermissions
in classSetting
- 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
-
getClient
public Client getClient() throws PermissionDeniedException, BaseException
Get the client application this setting is valid for.- Returns:
- The
Client
item - Throws:
PermissionDeniedException
- If the logged in user doesn't havePermission.READ
permissionBaseException
- If there is another error
-
setClient
void setClient(Client client) throws PermissionDeniedException, InvalidDataException
Set the client application this setting is valid for. Can only be set on a new item.- Throws:
InvalidDataException
- If the client is nullPermissionDeniedException
-
-