Class UserDataDescriptor

    • Method Detail

      • valueUserData

        public static Map<String,​Object> valueUserData​(Map<String,​?> userData)
        Creates a value that conforms to the UserDataDescriptor value descriptor. When the user data is null, the user data for an anonymous user are returned.
        Parameters:
        userData - The JSON object with the user data.
        Returns:
        A user data value conforming to UserDataDescriptor.
      • valueUserData

        public static List<Map<String,​Object>> valueUserData​(Iterable<String> userReferences,
                                                                   Iterable<UserProfile> userProfiles,
                                                                   Iterable<FormRecordSubmission> submissions)
        Creates a list of values that conform to the UserDataDescriptor value descriptor from the given universal user references, by resolving the references against the given list user profiles and form record submissions.

        For each user reference, first tries to find a matching submission in the list of submissions. When none is found, attempts to find a user profile with the same reference ID. If that is not found either, uses the user data for an anonymous user.

        The user references are universal reference IDs, see IUser.getUniversalReferenceId().

        When multiple submissions for the same user exist, the most recent form submission is used, see FormRecordSubmission.getSubmitInstant().

        Parameters:
        userReferences - A list of user references to resolve.
        submissions - A list of form record submission against which to resolve.
        Returns:
        A list of user data values conforming to UserDataDescriptor.
      • valueUserData

        public static Map<String,​Object> valueUserData​(String userReference,
                                                             UserProfile userProfile,
                                                             Iterable<FormRecordSubmission> submissions)
        Creates a value that conforms to the UserDataDescriptor value descriptor from the given universal user reference, by resolving the reference against the given list user profiles and form record submissions.

        First tries to resolve the given user references by looking up a matching submission from that user. If that fails, and the user profile matches the given reference ID, derives the user data from the given user profile. Otherwise, return the user data for an anonymous user.

        The user reference is a universal reference IDs, see IUser.getUniversalReferenceId().

        When multiple submissions for the same user exist, the most recent form submission is used, see FormRecordSubmission.getSubmitInstant().

        Parameters:
        userReference - A user references of the user, if known.
        userProfile - The user profile from which to derive the user data, if known.
        submissions - A list of form record submission against which to resolve the references.
        Returns:
        A list of user data values conforming to UserDataDescriptor.
      • valueUserData

        public static Map<String,​Object> valueUserData​(FormRecordSubmission submission)
        Creates a list of values that conform to the UserDataDescriptor value descriptor, by using the user data from the given form record submission. When the submission is null, returns null. When the submission does not have any user data, returns the user data for an anonymous user.
        Parameters:
        submission - A form record submission from which to extract the user data.
        Returns:
        A user data value conforming to UserDataDescriptor.
      • valueUserData

        public static Map<String,​Object> valueUserData​(IUser user)
        Creates a value that conforms to the UserDataDescriptor value descriptor. When the user is null, the user data for an anonymous user are returned.
        Parameters:
        user - The user with the user data.
        Returns:
        A user data value conforming to UserDataDescriptor.
      • valueUserData

        public static Map<String,​Object> valueUserData​(IUser user,
                                                             Mandant client)
        Creates a value that conforms to the UserDataDescriptor value descriptor. You can optionally provide a client scope. When given, the user data will be enriched with client specific data, such as the user's roles within that client scope. When the user is null, the user data for an anonymous user are returned.
        Parameters:
        user - The user with the user data.
        client - Optional client scope.
        Returns:
        A user data value conforming to UserDataDescriptor.