Class PreferenceServices
java.lang.Object
org.apache.ofbiz.common.preferences.PreferenceServices
User preference services.
User preferences are stored as key-value pairs.
User preferences can be grouped - so that multiple preference pairs can be handled at once. Preference groups also allow a single userPrefTypeId to be used more than once - with each occurence having a unique userPrefGroupTypeId.
User preference values are stored as Strings, so the easiest and most efficient way to handle user preference values is to keep them as strings. This class handles any data conversion needed.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncopyUserPreferenceGroup
(DispatchContext ctx, Map<String, ?> context) Copies a user preference group.getUserPreference
(DispatchContext ctx, Map<String, ?> context) Retrieves a single user preference from persistent storage.getUserPreferenceGroup
(DispatchContext ctx, Map<String, ?> context) Retrieves a group of user preferences from persistent storage.removeUserPreference
(DispatchContext ctx, Map<String, ?> context) setUserPreference
(DispatchContext ctx, Map<String, ?> context) Stores a single user preference in persistent storage.setUserPreferenceGroup
(DispatchContext ctx, Map<String, ?> context) Stores a user preference group in persistent storage.
-
Constructor Details
-
PreferenceServices
public PreferenceServices()
-
-
Method Details
-
getUserPreference
Retrieves a single user preference from persistent storage. Call with userPrefTypeId and optional userPrefLoginId. If userPrefLoginId isn't specified, then the currently logged-in user's userLoginId will be used. The retrieved preference is contained in the userPrefMap element.- Parameters:
ctx
- The DispatchContext that this service is operating in.context
- Map containing the input arguments.- Returns:
- Map with the result of the service, the output parameters.
-
getUserPreferenceGroup
Retrieves a group of user preferences from persistent storage. Call with userPrefGroupTypeId and optional userPrefLoginId. If userPrefLoginId isn't specified, then the currently logged-in user's userLoginId will be used. The retrieved preferences group is contained in the userPrefMap element.- Parameters:
ctx
- The DispatchContext that this service is operating in.context
- Map containing the input arguments.- Returns:
- Map with the result of the service, the output parameters.
-
setUserPreference
Stores a single user preference in persistent storage. Call with userPrefTypeId, userPrefGroupTypeId, userPrefValue and optional userPrefLoginId. If userPrefLoginId isn't specified, then the currently logged-in user's userLoginId will be used.- Parameters:
ctx
- The DispatchContext that this service is operating in.context
- Map containing the input arguments.- Returns:
- Map with the result of the service, the output parameters.
-
removeUserPreference
-
setUserPreferenceGroup
Stores a user preference group in persistent storage. Call with userPrefMap, userPrefGroupTypeId and optional userPrefLoginId. If userPrefLoginId isn't specified, then the currently logged-in user's userLoginId will be used.- Parameters:
ctx
- The DispatchContext that this service is operating in.context
- Map containing the input arguments.- Returns:
- Map with the result of the service, the output parameters.
-
copyUserPreferenceGroup
public static Map<String,Object> copyUserPreferenceGroup(DispatchContext ctx, Map<String, ?> context) Copies a user preference group. Call with fromUserLoginId, userPrefGroupTypeId and optional userPrefLoginId. If userPrefLoginId isn't specified, then the currently logged-in user's userLoginId will be used.- Parameters:
ctx
- The DispatchContext that this service is operating in.context
- Map containing the input arguments.- Returns:
- Map with the result of the service, the output parameters.
-