|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface UserDataService
A service for storing user-specific data (e.g. tool preferences) either temporarily (for the duration of the user's session) or permanently (cross-session)
The data stored by this service is always represented by a String. The methods that operate on other types all convert to/from the backing String.
All of the "get" methods require that a default value be passed. This value is used in two cases:
Passing false as the "required" parameter in the setter methods will (for the PERMANENT scope) set the value as being disposable. This value will not be guaranteed to be persistent forever as it may be removed by the system administrator. The required attribute has no effect on the TEMPORARY scope.
Care should be taken when using operations that access the PERMANENT scope so that unnecessary database calls are not made. The permanent scope is write-on-set, so a database call will be made each time a "set" method is called for the permanent scope. On the first "get" call on the permanent scope, all of the permanent data for the current user will be loaded and cached int the context for the duration of the request.
If a given scope is not supported, for example for temporary scope if the HttpSession
can't be resolved, a ScopeNotSupportedException exception will be thrown by
any method called on that scope.
| Nested Class Summary | |
|---|---|
static class |
UserDataService.Scope
The options for scopes to store the data in. |
| Field Summary | |
|---|---|
static java.lang.String |
PERMANENT_SCOPE_CACHE
|
| Method Summary | |
|---|---|
boolean |
getBoolean(java.lang.String key,
UserDataService.Scope scope,
boolean def)
Retrieves the boolean associated with the specified key in the specified scope. |
byte[] |
getByteArray(java.lang.String key,
UserDataService.Scope scope,
byte[] def)
Retrieves the byte array associated with the specified key in the specified scope. |
double |
getDouble(java.lang.String key,
UserDataService.Scope scope,
double def)
Retrieves the double associated with the specified key in the specified scope. |
float |
getFloat(java.lang.String key,
UserDataService.Scope scope,
float def)
Retrieves the float associated with the specified key in the specified scope. |
int |
getInt(java.lang.String key,
UserDataService.Scope scope,
int def)
Retrieves the int associated with the specified key in the specified scope. |
long |
getLong(java.lang.String key,
UserDataService.Scope scope,
long def)
Retrieves the long associated with the specified key in the specified scope. |
java.lang.String |
getString(java.lang.String key,
UserDataService.Scope scope,
java.lang.String def)
Retrieves the String associated with the specified key in the specified scope. |
void |
removeValue(java.lang.String key,
UserDataService.Scope scope)
Removes the value associated with the specified key in the specified scope. |
void |
setBoolean(java.lang.String key,
boolean value,
UserDataService.Scope scope)
Associates the specified boolean value with the specified key in the specified scope. |
void |
setBoolean(java.lang.String key,
boolean value,
UserDataService.Scope scope,
boolean required)
Associates the specified boolean value with the specified key in the specified scope. |
void |
setByteArray(java.lang.String key,
byte[] value,
UserDataService.Scope scope)
Associates the specified byte array value with the specified key in the specified scope. |
void |
setByteArray(java.lang.String key,
byte[] value,
UserDataService.Scope scope,
boolean required)
Associates the specified byte array value with the specified key in the specified scope. |
void |
setDouble(java.lang.String key,
double value,
UserDataService.Scope scope)
Associates the specified double value with the specified key in the specified scope. |
void |
setDouble(java.lang.String key,
double value,
UserDataService.Scope scope,
boolean required)
Associates the specified double value with the specified key in the specified scope. |
void |
setFloat(java.lang.String key,
float value,
UserDataService.Scope scope)
Associates the specified float value with the specified key in the specified scope. |
void |
setFloat(java.lang.String key,
float value,
UserDataService.Scope scope,
boolean required)
Associates the specified float value with the specified key in the specified scope. |
void |
setInt(java.lang.String key,
int value,
UserDataService.Scope scope)
Associates the specified int value with the specified key in the specified scope. |
void |
setInt(java.lang.String key,
int value,
UserDataService.Scope scope,
boolean required)
Associates the specified int value with the specified key in the specified scope. |
void |
setLong(java.lang.String key,
long value,
UserDataService.Scope scope)
Associates the specified long value with the specified key in the specified scope. |
void |
setLong(java.lang.String key,
long value,
UserDataService.Scope scope,
boolean required)
Associates the specified long value with the specified key in the specified scope. |
void |
setString(java.lang.String key,
java.lang.String value,
UserDataService.Scope scope)
Associates the specified String value with the specified key in the specified scope. |
void |
setString(java.lang.String key,
java.lang.String value,
UserDataService.Scope scope,
boolean required)
Associates the specified String value with the specified key in the specified scope. |
| Field Detail |
|---|
static final java.lang.String PERMANENT_SCOPE_CACHE
| Method Detail |
|---|
void setBoolean(java.lang.String key,
boolean value,
UserDataService.Scope scope)
key - key with which the value is to be associated.value - value to be associated with the specified key.scope - scope in which to store the association.
ScopeNotSupportedException - if the specified scope is not available/supported.
void setBoolean(java.lang.String key,
boolean value,
UserDataService.Scope scope,
boolean required)
key - key with which the value is to be associated.value - value to be associated with the specified key.scope - scope in which to store the association.required - whether or not the association may be removed to save space.
ScopeNotSupportedException - if the specified scope is not available/supported.
void setByteArray(java.lang.String key,
byte[] value,
UserDataService.Scope scope)
key - key with which the value is to be associated.value - value to be associated with the specified key.scope - scope in which to store the association.
ScopeNotSupportedException - if the specified scope is not available/supported.
void setByteArray(java.lang.String key,
byte[] value,
UserDataService.Scope scope,
boolean required)
key - key with which the value is to be associated.value - value to be associated with the specified key.scope - scope in which to store the association.required - whether or not the association may be removed to save space.
ScopeNotSupportedException - if the specified scope is not available/supported.
void setDouble(java.lang.String key,
double value,
UserDataService.Scope scope)
key - key with which the value is to be associated.value - value to be associated with the specified key.scope - scope in which to store the association.
ScopeNotSupportedException - if the specified scope is not available/supported.
void setDouble(java.lang.String key,
double value,
UserDataService.Scope scope,
boolean required)
key - key with which the value is to be associated.value - value to be associated with the specified key.scope - scope in which to store the association.required - whether or not the association may be removed to save space.
ScopeNotSupportedException - if the specified scope is not available/supported.
void setFloat(java.lang.String key,
float value,
UserDataService.Scope scope)
key - key with which the value is to be associated.value - value to be associated with the specified key.scope - scope in which to store the association.
ScopeNotSupportedException - if the specified scope is not available/supported.
void setFloat(java.lang.String key,
float value,
UserDataService.Scope scope,
boolean required)
key - key with which the value is to be associated.value - value to be associated with the specified key.scope - scope in which to store the association.required - whether or not the association may be removed to save space.
ScopeNotSupportedException - if the specified scope is not available/supported.
void setInt(java.lang.String key,
int value,
UserDataService.Scope scope)
key - key with which the value is to be associated.value - value to be associated with the specified key.scope - scope in which to store the association.
ScopeNotSupportedException - if the specified scope is not available/supported.
void setInt(java.lang.String key,
int value,
UserDataService.Scope scope,
boolean required)
key - key with which the value is to be associated.value - value to be associated with the specified key.scope - scope in which to store the association.required - whether or not the association may be removed to save space.
ScopeNotSupportedException - if the specified scope is not available/supported.
void setLong(java.lang.String key,
long value,
UserDataService.Scope scope)
key - key with which the value is to be associated.value - value to be associated with the specified key.scope - scope in which to store the association.
ScopeNotSupportedException - if the specified scope is not available/supported.
void setLong(java.lang.String key,
long value,
UserDataService.Scope scope,
boolean required)
key - key with which the value is to be associated.value - value to be associated with the specified key.scope - scope in which to store the association.required - whether or not the association may be removed to save space.
ScopeNotSupportedException - if the specified scope is not available/supported.
void setString(java.lang.String key,
java.lang.String value,
UserDataService.Scope scope)
key - key with which the value is to be associated.value - value to be associated with the specified key.scope - scope in which to store the association.
ScopeNotSupportedException - if the specified scope is not available/supported.
void setString(java.lang.String key,
java.lang.String value,
UserDataService.Scope scope,
boolean required)
key - key with which the value is to be associated.value - value to be associated with the specified key.scope - scope in which to store the association.required - whether or not the association may be removed to save space.
ScopeNotSupportedException - if the specified scope is not available/supported.
boolean getBoolean(java.lang.String key,
UserDataService.Scope scope,
boolean def)
key - key whose value is to be retrieved.scope - the scope in which to look for the key.def - value that will be returned if the specified key cannot be found or
if the value cannot be converted into a boolean.
ScopeNotSupportedException - if the specified scope is not available/supported.
byte[] getByteArray(java.lang.String key,
UserDataService.Scope scope,
byte[] def)
key - key whose value is to be retrieved.scope - the scope in which to look for the key.def - value that will be returned if the specified key cannot be found or
if the value cannot be converted into a byte array.
ScopeNotSupportedException - if the specified scope is not available/supported.
double getDouble(java.lang.String key,
UserDataService.Scope scope,
double def)
key - key whose value is to be retrieved.scope - the scope in which to look for the key.def - value that will be returned if the specified key cannot be found or
if the value cannot be converted into a double.
ScopeNotSupportedException - if the specified scope is not available/supported.
float getFloat(java.lang.String key,
UserDataService.Scope scope,
float def)
key - key whose value is to be retrieved.scope - the scope in which to look for the key.def - value that will be returned if the specified key cannot be found or
if the value cannot be converted into a float.
ScopeNotSupportedException - if the specified scope is not available/supported.
int getInt(java.lang.String key,
UserDataService.Scope scope,
int def)
key - key whose value is to be retrieved.scope - the scope in which to look for the key.def - value that will be returned if the specified key cannot be found or
if the value cannot be converted into a int.
ScopeNotSupportedException - if the specified scope is not available/supported.
long getLong(java.lang.String key,
UserDataService.Scope scope,
long def)
key - key whose value is to be retrieved.scope - the scope in which to look for the key.def - value that will be returned if the specified key cannot be found or
if the value cannot be converted into a boolean.
ScopeNotSupportedException - if the specified scope is not available/supported.
java.lang.String getString(java.lang.String key,
UserDataService.Scope scope,
java.lang.String def)
key - key whose value is to be retrieved.scope - the scope in which to look for the key.def - value that will be returned if the specified key cannot be found.
ScopeNotSupportedException - if the specified scope is not available/supported.
void removeValue(java.lang.String key,
UserDataService.Scope scope)
key - key whose value is to be removed.scope - the scope from which to remove the value.
ScopeNotSupportedException - if the specified scope is not available/supported.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||