TWiki
>
WebXEO Web
>
XeoPrimer
>
PreferenceStore
(revision 1) (raw view)
Edit
Attach
Tags:
tag this topic
create new tag
,
view all tags
-- Main.PedroRio - 2013-11-12 ---+ PreferenceStore If you need to save values in the database (but they don't fall into any XEO Model of your application and are more like preferences) you can use the PreferenceStore to do that. A Preference is nothing more than a key/value store where you can save values persistently, under different types. There are four different types of Preferences: * System (System wide preference) * Profile (Per-profile preference) * User (Per-user preference) * UserInProfile (Per User/Profile) To create/load a preference you need to get the PreferencesManager like the following: <pre><verbatim>PreferencesManager manager = boApplication.getXEO().getPreferencesManager();</verbatim> </pre> Once you have a PreferencesManager instance you can create the 4 types of preferences using: <pre><verbatim> Preference p = manager.getSystemPreference(String name) Preference p = manager.getProfilePreference(String name, String profile) Preference p = manager.getUserPreference(String name, String username) Preference p = manager.getUserInProfilePreference(String name, String username, String profilenam</verbatim> e<span style="background-color: transparent;">)</span></pre> <span style="background-color: transparent;">Each of these methods have a corresponding method which adds an additional parameter named "CustomContext" which basically gives a custom context to the preference (othewise it has no context)</span> Once you have a preference instance, you can set values like the following: <verbatim>p.setString(key,value); p.setBoolean(key,value); p.setLong(key,value)</verbatim> <br />and the corresponding: <verbatim>String value = p.getString(key): Boolean bolValue = p.getValue(key):</verbatim> In the end, save the preference <verbatim>p.savePreference();</verbatim> _ <span style="background-color: transparent;"><br /></span>
Edit
|
Attach
|
P
rint version
|
H
istory
:
r2
<
r1
|
B
acklinks
|
V
iew topic
|
Raw edit
|
More topic actions...
Topic revision: r1 - 2013-11-12
-
PedroRio
WebXEO
XEO Primer
-
Instalation
-
Introduction
-
Concepts
-
Architecture
-
XEO Library
-
Deploy to EAR
-
PreferenceStore
XEO - Core
-
XEO Model Reference
-
Security
-
Java API
-
BOL
-
XEOQL (BOQL)
-
Administrating
-
Background Tasks
-
boConfig.xml
-
Web.xml
-
Known Issues
-
XEO Flags
XEO - XWC
- Web Components
- Java Samples
- Custom Components
- Component Plugins
- Internationalization
- Viewer Events
- Value Change Listeners
- XUIServlet
- XeoLocalization
- XvwTemplates
Create New Topic
WebXEO Web
No permission to view
TWiki.WebTopBar
No permission to view
TWiki.WebBottomBar