/** * This file is auto generated from JavaDoc. Do not modify it manually. */ import type { Set } from "../../types/java/util/Set"; import type { String } from "../../types/java/lang/String"; import type { Serializable } from "../../types/java/io/Serializable"; import type { Node } from "../../types/javax/jcr/Node"; /** * User data utility interface. * *

* The portlet specification allows access of user-specific data via a read-only java.util.Map * that can be obtained as request attribute using the PortletRequest.USER_INFO constant. * This utility is a convenience to get such user data, but it also extends it by allowing write operations * and access other user's data. Data written via this utility can be accesses via the Map exposed via the * PortletRequest.USER_INFO constant and vice versa. Hence, with this utility there are no need to use * the portlet specification mechanism for accessing user data. *

* *

* Mutating data operations (set/remove) on other users requires certain permissions, see individual method documentation. *

* *

* Important note! The user data mechanism is closely tied to a specific user object and is intended to handle * basic user information and user preferences. Adding "too much" (count) or "too large" (size) user data * might cause persistence implications and performance implications. *

* *

* An instance of the Sitevision class implementing this interface can be obtained via {@link UserFactory#getUserDataUtil()}. * See {@link senselogic.sitevision.api.user.UserFactory} for how to obtain an instance of the UserFactory interface. *

* @author Magnus Lövgren * @since Sitevision 4.1 */ export interface UserDataUtil { /** * The read-only keys. * *

* Mutating operations (set/remove) with any of these keys will be ignored. *

*

* Note that internal-only properties are not included in the returned set, but they will also be ignored in mutating operations. *

* @return a set of keys that are read-only */ getReadOnlyKeys(): Set; /** * Gets user data for current user. * *

* This read operation is equivalent to using the user info mechanism of the portlet specification. *

* @param aUserDataKey the data key * @return the value for aUserDataKey (typically a String), or null */ getUserData(aUserDataKey: String | string): Serializable; /** * Gets user data for a user. * @param aUserNode the user node (typically a sv:user or sv:simpleUser) * @param aUserDataKey the data key * @return the value for aUserDataKey (typically a String), or null */ getUserData(aUserNode: Node, aUserDataKey: String | string): Serializable; /** * Sets user data for current user. * *

* This write operation is equivalent to using the Sitevision-specific user info mechanism of the portlet specification. *

* *

* Important note! The set/write operation will be ignored if aUserDataKey is null, whitespace-only or * read-only (see {@link #getReadOnlyKeys}). The set operation will also be ignored if aSerializableValue * is null. * Use {@link #removeUserData(String)} to remove data instead. *

* @param aUserDataKey the data key * @param aSerializableValue the data value (typically a String) */ setUserData( aUserDataKey: String | string, aSerializableValue: Serializable ): void; /** * Sets user data for a user. * *

* Important note! The set/write operation will be ignored if aUserDataKey is null, whitespace-only or * read-only (see {@link #getReadOnlyKeys}). The set operation will also be ignored if aSerializableValue * is null. * Use {@link #removeUserData(String)} to remove data instead. *

* *

* Permission note! Current user (as of {@link senselogic.sitevision.api.context.PortletContextUtil#getCurrentUser()}) must have * {@link senselogic.sitevision.api.security.PermissionUtil.Permission#WRITE} on current site * (as of {@link senselogic.sitevision.api.resource.ResourceLocatorUtil#getSite()}), otherwise the set/write operation will be ignored. *

* @param aUserNode the user node (typically a sv:user or sv:simpleUser) * @param aUserDataKey the data key * @param aSerializableValue the data value (typically a String) */ setUserData( aUserNode: Node, aUserDataKey: String | string, aSerializableValue: Serializable ): void; /** * Removes user data. * *

* Important note! The remove/delete operation will be ignored if aUserDataKey is null, whitespace-only or * read-only (see {@link #getReadOnlyKeys}). *

* @param aUserDataKey the data key */ removeUserData(aUserDataKey: String | string): void; /** * Removes user data for a user. * *

* Important note! The remove/delete operation will be ignored if aUserDataKey is null, whitespace-only or * read-only (see {@link #getReadOnlyKeys}). *

* *

* Permission note! Current user (as of {@link senselogic.sitevision.api.context.PortletContextUtil#getCurrentUser()}) must have * {@link senselogic.sitevision.api.security.PermissionUtil.Permission#WRITE} on current site * (as of {@link senselogic.sitevision.api.resource.ResourceLocatorUtil#getSite()}), otherwise the remove/delete operation will be ignored. *

* @param aUserNode the user node (typically a sv:user or sv:simpleUser) * @param aUserDataKey the data key */ removeUserData(aUserNode: Node, aUserDataKey: String | string): void; } declare namespace UserDataUtil {} declare var userDataUtil: UserDataUtil; export default userDataUtil;