|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.basedb.core.SessionControl
public class SessionControl
This class handles user sessions. Each instance is thread-safe and
can handle a single user at a time. This class is used
to create DbControl
objects which are needed to access the
database.
Application.newSessionControl(String, String, String)
,
Application.getSessionControl(String, String)
Nested Class Summary | |
---|---|
private static class |
SessionControl.LoginInfo
Internal class to hold information about the logged in user. |
private static class |
SessionControl.SettingInfo
Internal class to hold information about a setting |
Field Summary | |
---|---|
private Map<String,SessionControl.SettingInfo> |
clientDefaultSettings
Stores name and value from ClientDefaultSettingData . |
private int |
clientId
The id of the ClientData . 0 = no client |
private boolean |
closed
If the session control has been closed it can no longer be used. |
private Map<ContextKey,ItemContext> |
currentContexts
Map for storing current contexts. |
private Map<DbControl,String> |
dbControlCache
Holds all created DbControl object, so we can close
them if the user logs out. |
private String |
externalClientId
The external id of the ClientData . null = no client |
private String |
id
The id of the object. |
private int |
jobId
|
private long |
lastAccess
The time of the last access to this object. |
private String |
lastChallenge
The last generated challenge for password encryption. |
private static Logger |
log
Log core events. |
private SessionControl.LoginInfo |
loginInfo
Login information for the logged in user. |
private int |
pluginId
|
private String |
remoteId
The remote IP. |
Constructor Summary | |
---|---|
SessionControl(String id,
SessionControl parent,
PluginDefinition plugin,
Job job)
Create a new session control object using another one as the template. |
|
SessionControl(String id,
String externalClientId,
boolean failIfNoClient,
String remoteId)
Creates a new SessionControl object. |
Method Summary | ||
---|---|---|
protected void |
cleanUp()
|
|
protected void |
clearDbControlCache()
|
|
void |
close()
Close this session control so it can't be used again. |
|
private SessionControl.LoginInfo |
createLoginInfo(org.hibernate.Session session,
UserData userData,
String comment,
boolean impersonated)
Create a LoginInfo object and load all information that it needs. |
|
void |
deleteContext(int contextId)
Delete a context. |
|
int |
deleteCurrentContexts(Item itemType,
boolean inMemory,
boolean inDatabase)
Delete all default contexts for the logged in user. |
|
protected void |
finalize()
Clean up if a bad client application forgets to logout. |
|
int |
getActiveProjectId()
Get the id of the active project, or 0 if no project is active. |
|
List<ItemContext> |
getAllCurrentContexts(boolean inMemory,
boolean inDatabase)
Get a list with the current default contexts. |
|
(package private) int |
getAllPermissions(Item itemType,
UserData owner,
ItemKeyData itemKey,
ProjectKeyData projectKey)
Get the combined permissions for an item of the specified type, owned by the specified user and shared with the specified item and project keys. |
|
(package private) int |
getAllPermissions(SharedData sharedData)
Same as getAllPermissions(Item, UserData, ItemKeyData, ProjectKeyData) |
|
String |
getChallenge()
Generate a new random string to be used for password encryption in the login method. |
|
String |
getClientDefaultSetting(String name)
Get the value of the ClientDefaultSetting with the
specified name. |
|
int |
getClientId()
Get the id of the Client application in use. |
|
ItemContext |
getContext(int contextId)
Load a context without making it the current context. |
|
Enumeration<Integer,String> |
getContextNames(Item item)
Same as: getContextNames(item, "") |
|
Enumeration<Integer,String> |
getContextNames(Item item,
String subContext)
Get a list with the names of all named contexts for a given item and subcontext. |
|
ItemContext |
getCurrentContext(Item item)
Same as: getCurrentContext(item, "", null) . |
|
ItemContext |
getCurrentContext(Item item,
ItemContext defaultContext)
Same as: getCurrentContext(item, "", defaultContext) . |
|
ItemContext |
getCurrentContext(Item item,
String subContext)
Same as: getCurrentContext(item, subContext, null) . |
|
ItemContext |
getCurrentContext(Item item,
String subContext,
ItemContext defaultContext)
Get the current context. |
|
int |
getCurrentSessionId()
Get the id of the current user session, or 0 if no user is logged in. |
|
String |
getExternalClientId()
Get the external id of the Client application in use. |
|
Set<Integer> |
getFriends()
Get the id of all friends to logged in user. |
|
Set<Integer> |
getGroups()
Get the id of all groups where the logged in user is a member, directly or indirectly. |
|
String |
getId()
Get the id of this SessionControl . |
|
int |
getItemKeyId()
Get the id of the ItemKey that new items should be shared to
according to the settings in the currently active project. |
|
Set<Integer> |
getItemKeys()
Get the id of all item keys where the logged in user has read permission. |
|
Set<Integer> |
getItemKeys(Permission permission)
Get the id of all item keys where the logged in user has the requested permission. |
|
int |
getJobId()
Get the id of the job that is currently running with this session control. |
|
long |
getLastAccess()
Get the time this object last was accessed. |
|
private String |
getLastChallenge()
Get the last challenge generated. |
|
Locale |
getLocale()
Get the locale that is curently assigned to this session control. |
|
int |
getLoggedInUserId()
Get the id of the logged in user, or 0 if no user is logged in. |
|
int |
getPluginId()
Get the id of the plug-in that is currently running with this session control. |
|
(package private) PluginPermission |
getPluginPermissions(Item itemType)
Get all plugin-specific permissions for the specified item type. |
|
PluginSessionControl |
getPluginSessionControl(PluginDefinition plugin,
Job job)
Create a new session control for executing a plugin. |
|
int |
getProjectKeyId()
Get the id of the ProjectKey that can be used to share an item to
the active project with full permission, or 0 if no project is active or
the logged in user only has read permission to the active project. |
|
Set<Integer> |
getProjectKeys()
Get the id of all project keys where the logged in user has read permission. |
|
Set<Integer> |
getProjectKeys(Permission permission)
Get the id of all project keys where the logged in user has the requested permission. |
|
(package private) int |
getProjectPermission(Project project)
|
|
Set<Integer> |
getProjects()
Get the id of all projects where the logged in user is a member, directly or indirectly. |
|
(package private) String |
getRemoteId()
Get the remote id that was passed to the Application.newSessionControl(String,String,String) method when creating this
object. |
|
(package private) int |
getRolePermissions(Item itemType)
Get all role-based permissions for the specified type of items. |
|
Set<Integer> |
getRoles()
Get the id of all roles where the logged in user is a member. |
|
Object |
getSessionSetting(String name)
Get the value of a session setting with the specified name. |
|
(package private) int |
getSharedPermissions(ShareableData shareableData)
Get the shared permissions for a ShareableData object. |
|
String |
getUserClientSetting(String name)
Get the value of the UserClientSetting with the
specified name. |
|
String |
getUserDefaultSetting(String name)
Get the value of the UserDefaultSetting with the
specified name. |
|
boolean |
hasPermission(Permission permission,
Item itemType)
Check if the logged in user has the specfied permission for all item of the specified type. |
|
boolean |
hasSystemPermission(Permission permission)
Check if the logged in user has the specified system permission. |
|
SessionControl |
impersonateLogin(int userId,
String comment)
Log in as another user. |
|
SessionControl |
impersonateLogin(Ownable item,
String comment)
Log in as the owner of the specified item. |
|
boolean |
isClosed()
If this session control has been closed or not. |
|
boolean |
isDenied(Permission permission,
Item itemType)
Check if the logged in user has been denied the specified permission for items of the specified type. |
|
boolean |
isFriendOf(User user)
Check if the logged in user is a friend of of the specified user. |
|
boolean |
isImpersonated()
Check if the logged in user was impersonated by another user. |
|
boolean |
isLoggedIn()
Checks if a user is logged in or not. |
|
boolean |
isMemberOf(Group group)
Check if the logged in user is a member, directly or indirectly, of the specified group. |
|
boolean |
isMemberOf(Project project)
Check if the logged in user is a member, directly or indirectly, of the specified project. |
|
boolean |
isMemberOf(Role role)
Check if the logged in user is a member of the specified role. |
|
private Map<String,SessionControl.SettingInfo> |
listToMap(List<? extends SettingData> settings)
Copy settings from a List to a Map. |
|
private Map<String,SessionControl.SettingInfo> |
loadClientDefaultSettings(org.hibernate.Session session,
int clientId)
Load client applications default settings. |
|
ItemContext |
loadContext(int contextId)
Load a context and make it the current context. |
|
private ItemContext |
loadContextInternal(int contextId)
Load a context with the specified ID. |
|
private ItemContext |
loadContextInternal(Item item,
String subContext,
String name)
Load a named context. |
|
private Map<String,SessionControl.SettingInfo> |
loadUserClientSettings(org.hibernate.Session session,
int userId,
int clientId)
Load users client-specific settings. |
|
private Map<String,SessionControl.SettingInfo> |
loadUserDefaultSettings(org.hibernate.Session session,
int userId)
Load users default settings. |
|
(package private) void |
login(Keyring keyring)
|
|
void |
login(String login,
String password,
String comment,
boolean encryptedPassword)
Log in to BASE. |
|
void |
logout()
Log out of BASE. |
|
DbControl |
newDbControl()
Create a new DbControl object for this session. |
|
void |
reloadPermissions()
Tell the core to reload the logged in users permission the next time the client application needs to check the permissions. |
|
void |
reloadSettings(boolean onlyClientDefaultSettings,
boolean saveCurrentUserSettings)
Reloads user- and client-specific settings. |
|
private void |
saveAllCurrentContexts(org.hibernate.Session session,
UserData userData,
ClientData clientData)
|
|
private void |
saveAllUserSettings(org.hibernate.Session session)
Saves all user settings. |
|
int |
saveCurrentContextAs(Item item,
String name,
boolean overwrite,
boolean isPublic)
Same as: saveCurrentContextAs(item, "", name, overwrite, isPublic) . |
|
int |
saveCurrentContextAs(Item item,
String subContext,
String name,
boolean overwrite,
boolean isPublic)
Save the current context as a named context. |
|
private
|
saveSettings(org.hibernate.Session session,
org.hibernate.Query query,
Map<String,SessionControl.SettingInfo> settings,
Class<I> dataClass,
UserData userData,
ClientData clientData)
Save settings when a user logs out. |
|
void |
setActiveProject(Project project)
Set the active project. |
|
Object |
setSessionSetting(String name,
Object value)
Set the value of a session setting. |
|
String |
setUserClientSetting(String name,
String value)
Set the value of a UserClientSetting . |
|
String |
setUserDefaultSetting(String name,
String value)
Set the value of a UserDefaultSetting . |
|
void |
updateLastAccess()
Update the time this object last was accessed. |
|
private UserData |
verifyUserExternal(org.hibernate.Session session,
String login,
String password)
Verify the user with external authentication. |
|
private UserData |
verifyUserInternal(org.hibernate.Session session,
String login,
String password,
boolean encryptedPassword)
Check that the user exists and verify the password using internal authentication. |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final Logger log
private final String id
Application.getSessionControl(String,String)
private final int clientId
ClientData
. 0 = no client
private final String externalClientId
ClientData
. null = no client
private final String remoteId
private final Map<DbControl,String> dbControlCache
DbControl
object, so we can close
them if the user logs out. We use only the keys of the map since there
is no WeakHashSet
class.
private long lastAccess
private boolean closed
private Map<String,SessionControl.SettingInfo> clientDefaultSettings
ClientDefaultSettingData
.
private SessionControl.LoginInfo loginInfo
private String lastChallenge
private final Map<ContextKey,ItemContext> currentContexts
private int pluginId
private int jobId
Constructor Detail |
---|
SessionControl(String id, SessionControl parent, PluginDefinition plugin, Job job)
id
- The ID if the new session controlparent
- The parent session controlplugin
- The plugin that is executingSessionControl(String id, String externalClientId, boolean failIfNoClient, String remoteId) throws BaseException
SessionControl
object.
id
- The id used in Application.newSessionControl(String,String,String)
externalClientId
- Optional external ID of the client application in usefailIfNoClient
- If TRUE, an exception is thrown if an external client id
has been specified, but not foundremoteId
- For example, the IP-address
BaseException
Method Detail |
---|
public long getLastAccess()
Application.cleanSessionControlCache(boolean)
public void updateLastAccess()
Application.cleanSessionControlCache(boolean)
public boolean isClosed()
public void close()
public String getId()
SessionControl
. Use this value for
retrieving the object from the Application
cache.
Application.getSessionControl(String,String)
public int getClientId()
Client
application in use. Use
Client.getById(DbControl, int)
to get the Client
object.
public String getExternalClientId()
Client
application in use.
getClientId()
String getRemoteId()
Application.newSessionControl(String,String,String)
method when creating this
object. This value is checked against the value passed to the Application.getSessionControl(String,String)
method.
public DbControl newDbControl() throws BaseException
DbControl
object for this session.
DbControl
object
BaseException
- If there is an errorvoid login(Keyring keyring)
public String getChallenge()
The client application should use the challenge as follows:
MD5:challenge
Note! This is not intended as a replacement for SSL encrypted communication.
Note! Each call to this method generates a new random challenge.
login(String, String, String, boolean)
private String getLastChallenge()
public void login(String login, String password, String comment, boolean encryptedPassword) throws ItemNotFoundException, PermissionDeniedException, InvalidPasswordException, BaseException
The encryptedPassword
parameter is used if the client
application sends the password encrypted. See getChallenge()
for information about how to encrypt the password.
login
- The login of the userpassword
- The UTF-8 encoded password for the usercomment
- A comment for the login, which will show in the Session
encryptedPassword
- A flag indicating if the password has been encrypted
or not
ItemNotFoundException
- If a user with the specified username is not found
InvalidPasswordException
- If the specified password is incorrect
PermissionDeniedException
- If the user doesn't have
Permission.USE
permission for the current client
application or if a user is already logged in
BaseException
- If there is any other errorlogout()
,
isLoggedIn()
,
getLoggedInUserId()
private UserData verifyUserInternal(org.hibernate.Session session, String login, String password, boolean encryptedPassword) throws ItemNotFoundException, InvalidPasswordException, AccountExpiredException, BaseException
ItemNotFoundException
InvalidPasswordException
AccountExpiredException
BaseException
private UserData verifyUserExternal(org.hibernate.Session session, String login, String password) throws ItemNotFoundException, InvalidPasswordException, BaseException
ItemNotFoundException
InvalidPasswordException
BaseException
public SessionControl impersonateLogin(int userId, String comment) throws ItemNotFoundException, PermissionDeniedException, BaseException
SessionControl
object which is equivalent to a SessionControl
where that user logged in by normal means. This method requires that the logged
in user has Permission.ACT_AS_ANOTHER_USER
permission.
userId
- The id of the user to login ascomment
- A comment that will be placed in the Session
information
SessionControl
object
ItemNotFoundException
- If no user with the specified id exists
PermissionDeniedException
- If the logged in user doesn't
have Permission.ACT_AS_ANOTHER_USER
permission
BaseException
- If there is another errorpublic SessionControl impersonateLogin(Ownable item, String comment)
item
- Login as the owner of this Item. Null is not allowedcomment
- A comment that will be placed in the Session
information
SessionControl
for the created session.impersonateLogin(int, String)
private SessionControl.LoginInfo createLoginInfo(org.hibernate.Session session, UserData userData, String comment, boolean impersonated) throws BaseException
BaseException
public void logout() throws BaseException
DbControl
objects still open, they
will be closed. Changes made to items managed by those DbControl
objects will be lost unless the items are connected to a new DbControl
object.
BaseException
- If there is an errorlogin(String, String, String, boolean)
,
isLoggedIn()
,
impersonateLogin(int, String)
,
isImpersonated()
public boolean isLoggedIn()
login(String, String, String, boolean)
,
logout()
,
getLoggedInUserId()
public int getLoggedInUserId()
User.getById(DbControl, int)
to get the User
object.
login(String, String, String, boolean)
,
logout()
,
isLoggedIn()
public int getCurrentSessionId()
Session.getById(DbControl, int)
to the Session
object.
public int getPluginId()
public int getJobId()
public boolean isImpersonated()
impersonateLogin(int, String)
public void reloadPermissions()
public void reloadSettings(boolean onlyClientDefaultSettings, boolean saveCurrentUserSettings) throws BaseException
onlyClientDefaultSettings
- Setting this to TRUE will only reload
ClientDefaultSetting
:ssaveCurrentUserSettings
- Setting this to TRUE will save the current user-specific
settings before reloading them. This parameter is ignored if onlyClientDefaultSettings
is true. The settings are never changed if the logged in user is a multi-user account.
BaseException
- If the settings cannot be reloadedpublic int getActiveProjectId()
Project.getById(DbControl, int)
to get the Project
object.
setActiveProject(Project)
public void setActiveProject(Project project) throws PermissionDeniedException, BaseException
Shareable
items will automatically be shared to the active project with delete permission.
The active project doesn't affect already existing items.
project
- The project to make active
PermissionDeniedException
- If the logged in user doesn't have
Permission.USE
permission for the project
BaseException
- If there is another errorgetActiveProjectId()
public PluginSessionControl getPluginSessionControl(PluginDefinition plugin, Job job)
plugin
- The plugin to executejob
- The job that executes the plug-in, or null
public int getProjectKeyId()
ProjectKey
that can be used to share an item to
the active project with full permission, or 0 if no project is active or
the logged in user only has read permission to the active project.
Use ProjectKey.getById(DbControl, int)
to get the ProjectKey
object.
getActiveProjectId()
,
setActiveProject(Project)
public int getItemKeyId()
ItemKey
that new items should be shared to
according to the settings in the currently active project. If no
project is active or if the projects doesn't share to any item
key, 0 is returned.
Use ItemKey.getById(DbControl, int)
to get the ItemKey
object.
getActiveProjectId()
,
setActiveProject(Project)
,
getProjectKeyId()
public boolean hasSystemPermission(Permission permission)
permission
- One of the system permission constants defined
by the Permission
enumeration
public boolean hasPermission(Permission permission, Item itemType)
permission
- One of the permissions constants defined
by the Permission
enumerationitemType
- One of the item constants defined by the
Item
enumeration
public boolean isDenied(Permission permission, Item itemType)
hasPermission(Permission, Item)
method. Both
methods may return false in which case the system also checks ownership
and sharing information to determine if access is granted. If this method
return TRUE the hasPermission
method always return false.
permission
- One of the permissions constants defined
by the Permission
enumerationitemType
- One of the item constants defined by the
Item
enumeration
int getRolePermissions(Item itemType)
PluginPermission getPluginPermissions(Item itemType)
int getSharedPermissions(ShareableData shareableData)
ShareableData
object.
int getAllPermissions(Item itemType, UserData owner, ItemKeyData itemKey, ProjectKeyData projectKey)
int getAllPermissions(SharedData sharedData)
getAllPermissions(Item, UserData, ItemKeyData, ProjectKeyData)
public boolean isMemberOf(Group group)
group
- The group to check
public boolean isMemberOf(Role role)
role
- The role to check
public boolean isMemberOf(Project project)
project
- The project to check
int getProjectPermission(Project project)
public boolean isFriendOf(User user)
user
- The user to check
public Set<Integer> getRoles()
Set
containing role id:spublic Set<Integer> getGroups()
Set
containing group id:spublic Set<Integer> getFriends()
Set
containing user id:spublic Set<Integer> getProjects()
Set
containing project id:spublic Set<Integer> getItemKeys()
Set
containing item key id:spublic Set<Integer> getItemKeys(Permission permission)
permission
- Requested permissions.
Set
containing item key id:spublic Set<Integer> getProjectKeys()
Set
containing project key id:spublic Set<Integer> getProjectKeys(Permission permission)
permission
- The requested permissions
Set
containing project key id:spublic ItemContext getCurrentContext(Item item)
getCurrentContext(item, "", null)
.
getCurrentContext(Item, String, ItemContext)
public ItemContext getCurrentContext(Item item, String subContext)
getCurrentContext(item, subContext, null)
.
getCurrentContext(Item, String, ItemContext)
public ItemContext getCurrentContext(Item item, ItemContext defaultContext)
getCurrentContext(item, "", defaultContext)
.
item
- Type of item for which current context should be returned.defaultContext
- A default context to copy values from if a new context
must be created
ItemContext
object.getCurrentContext(Item, String, ItemContext)
public ItemContext getCurrentContext(Item item, String subContext, ItemContext defaultContext)
item
- The type of item to get the context forsubContext
- Current sub context.defaultContext
- A default context to copy values from if a new context
must be created.
ItemContext
object.
InvalidDataException
- If the item is null
BaseException
- If there is another errorgetCurrentContext(Item)
,
loadContextInternal(Item, String, String)
,
saveCurrentContextAs(Item, String, boolean, boolean)
public ItemContext loadContext(int contextId) throws NotLoggedInException, BaseException
contextId
- The ID of the context to load
ItemContext
object or null
NotLoggedInException
- If no user is logged in
BaseException
- If there is another errorsaveCurrentContextAs(Item, String, boolean, boolean)
,
getContextNames(Item)
public ItemContext getContext(int contextId)
contextId
- The ID of the context to load
ItemContext
object or null
NotLoggedInException
- If no user is logged in
BaseException
- If there is another errorloadContext(int)
,
getContextNames(Item)
public int saveCurrentContextAs(Item item, String name, boolean overwrite, boolean isPublic) throws PermissionDeniedException, InvalidDataException, ItemAlreadyExistsException, BaseException
saveCurrentContextAs(item, "", name, overwrite, isPublic)
.
PermissionDeniedException
InvalidDataException
ItemAlreadyExistsException
BaseException
saveCurrentContextAs(Item, String, String, boolean, boolean)
public int saveCurrentContextAs(Item item, String subContext, String name, boolean overwrite, boolean isPublic) throws PermissionDeniedException, InvalidDataException, ItemAlreadyExistsException, BaseException
loadContext(int)
method. If no current context
exists, this method does nothing.
item
- The type of item to save the current context forsubContext
- The name of the sub-contextname
- The name of the contextoverwrite
- If TRUE, an existing context with the same name is
overwritten, otherwise an exception is thrownisPublic
- If the saved context should be visible to everyone
or not (requires Permission.SHARE_TO_EVERYONE
permission)
PermissionDeniedException
- If no user is logged in,
or if the logged in user is a multi-user account or if the isPublic
parameter is true but the logged in user doesn't have SHARE_TO_EVERYONE
permission
InvalidDataException
- If the item or name parameter is null
ItemAlreadyExistsException
- If another context with the
same name exists and the overwrite parameter is FALSE
BaseException
- If there is another errorpublic void deleteContext(int contextId) throws PermissionDeniedException, BaseException
contextId
- The id of the context
PermissionDeniedException
- If no user is logged in,
or if he logged in user is a multi-user account or isn't the owner of the context
BaseException
- If there is another errorgetContextNames(Item, String)
public Enumeration<Integer,String> getContextNames(Item item) throws InvalidDataException, BaseException
getContextNames(item, "")
InvalidDataException
BaseException
getContextNames(Item, String)
public Enumeration<Integer,String> getContextNames(Item item, String subContext) throws InvalidDataException, BaseException
item
- Item for which named contexts should be returnedsubContext
- Certain sub context to return contexts for.
InvalidDataException
- If the item parameter is null
BaseException
- If there is another errorprivate ItemContext loadContextInternal(int contextId) throws BaseException
BaseException
private ItemContext loadContextInternal(Item item, String subContext, String name) throws BaseException
BaseException
private void saveAllCurrentContexts(org.hibernate.Session session, UserData userData, ClientData clientData)
public List<ItemContext> getAllCurrentContexts(boolean inMemory, boolean inDatabase)
ItemContext.getContextId()
returns the same value.
inMemory
- If TRUE, the in-memory contexts are included in the listinDatabase
- If TRUE, the in-database contexts are included in the list
public int deleteCurrentContexts(Item itemType, boolean inMemory, boolean inDatabase)
itemType
- The item type to delete the contexts for, or null
to delete all contextsinMemory
- TRUE to delete in-memory contextsinDatabase
- TRUE to delete in-database contexts
public Locale getLocale()
public Object getSessionSetting(String name)
name
- The name of the setting
public Object setSessionSetting(String name, Object value)
name
- The name of the settingvalue
- The new value of the setting, or null to remove the
setting
public String getUserClientSetting(String name)
UserClientSetting
with the
specified name. If no user is logged in null is returned.
name
- The name of the setting
public String setUserClientSetting(String name, String value)
UserClientSetting
.
name
- The name of the settingvalue
- The new value of the setting, or null to remove the
setting
public String getUserDefaultSetting(String name)
UserDefaultSetting
with the
specified name.
name
- The name of the setting
public String setUserDefaultSetting(String name, String value)
UserDefaultSetting
.
name
- The name of the settingvalue
- The new value of the setting, or null to remove the
setting
public String getClientDefaultSetting(String name)
ClientDefaultSetting
with the
specified name.
name
- The name of the setting
private Map<String,SessionControl.SettingInfo> listToMap(List<? extends SettingData> settings)
SettingData.getName()
) and the value is a SessionControl.SettingInfo
object.
private Map<String,SessionControl.SettingInfo> loadClientDefaultSettings(org.hibernate.Session session, int clientId)
private Map<String,SessionControl.SettingInfo> loadUserDefaultSettings(org.hibernate.Session session, int userId)
private Map<String,SessionControl.SettingInfo> loadUserClientSettings(org.hibernate.Session session, int userId, int clientId)
private void saveAllUserSettings(org.hibernate.Session session)
private <I extends SettingData> void saveSettings(org.hibernate.Session session, org.hibernate.Query query, Map<String,SessionControl.SettingInfo> settings, Class<I> dataClass, UserData userData, ClientData clientData) throws BaseException
session
- The Hibernate sessionquery
- A Hibernate query to load the settings already in the databasesettings
- The settings to savedataClass
- The Class
of the settings, should be one of
UserDefaultSettingData
or UserClientSettingData
userData
- The UserData
object for the logged in userclientData
- The ClientData
object for the client application
BaseException
protected void clearDbControlCache()
protected void cleanUp()
protected void finalize() throws Throwable
finalize
in class Object
Throwable
|
2.17.2: 2011-06-17 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |