Class UserDataDescriptor
- All Implemented Interfaces:
IAttributeConfigurable<IValueDescriptor<Map<String,?>, IRecordValueBuilder>>, IRecordValueDescriptor, IValueDescriptor<Map<String, ?>, IRecordValueBuilder>, Serializable
IValueDescriptor for the data of a user. The structure of the data is the same for example
the system placeholder [%$USER%]. See also UserMgmtUtils.toJson(IUser).- See Also:
-
Field Summary
Fields inherited from class RecordValueDescriptorWrapper
delegate -
Method Summary
Modifier and TypeMethodDescriptionvalueUserData(FormRecordSubmission submission) Creates a list of values that conform to theUserDataDescriptorvalue descriptor, by using theuser datafrom the given form record submission.valueUserData(IUser user) Creates a value that conforms to theUserDataDescriptorvalue descriptor.valueUserData(IUser user, Mandant client) Creates a value that conforms to theUserDataDescriptorvalue descriptor.valueUserData(Iterable<FormRecordAccess> accesses, Iterable<FormRecordSubmission> submissions) Creates a list of values that conform to theUserDataDescriptorvalue descriptor from the given universal user references, by resolving the references against the given list user profiles and form record submissions.valueUserData(String userReference, UserProfile profile) Creates a value that conforms to theUserDataDescriptorvalue descriptor, using the data form the given user profile.valueUserData(String userReference, UserProfile userProfile, Iterable<FormRecordSubmission> submissions) Creates a value that conforms to theUserDataDescriptorvalue descriptor from the given universal user reference, by resolving the reference against the given list user profiles and form record submissions.valueUserData(Map<String, ?> userData) Creates a value that conforms to theUserDataDescriptorvalue descriptor.Methods inherited from class RecordValueDescriptorWrapper
acceptsValue, acceptsValue, asAny, asBoolean, asConst, asFloat, asInteger, asLargeString, asList, asList, asMap, asMap, asNull, asRecord, asString, asTuple, asUnion, asUnion, asVoid, builder, builder, configure, getAttribute, getAttribute, getAttributes, getBaseType, getBooleanAttribute, getBooleanAttribute, getDefaultValue, getDescription, getFloatAttribute, getFloatAttribute, getFullType, getFullTypeWithRestrictions, getIntegerAttribute, getIntegerAttribute, getJavaClass, getKnownProperties, getKnownProperties, getRecordValueDescriptors, getStringAttribute, getStringAttribute, intersect, is, match, toString, unwrap, withAddedAttribute, withAddedAttributes, withAttributes, withDefaultValue, withDescription
-
Method Details
-
valueUserData
Creates a value that conforms to theUserDataDescriptorvalue descriptor. When the user data is null, the user data for ananonymoususer 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<FormRecordAccess> accesses, Iterable<FormRecordSubmission> submissions) Creates a list of values that conform to theUserDataDescriptorvalue 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
anonymoususer.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:
accesses- A list of accesses to resolve.submissions- A list of form record submission against which to resolve.- Returns:
- A list of user data values conforming to
UserDataDescriptor.
-
valueUserData
Creates a value that conforms to theUserDataDescriptorvalue descriptor, using the data form the given user profile. When the user data is null, the user data for ananonymoususer is returned.- Parameters:
userReference- Theuniversal reference IDof one of theuser profile's identities.profile- The user profile from which to derive the user data.- Returns:
- A user data value conforming to
UserDataDescriptor.
-
valueUserData
public static Map<String,Object> valueUserData(String userReference, UserProfile userProfile, Iterable<FormRecordSubmission> submissions) Creates a value that conforms to theUserDataDescriptorvalue 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
anonymoususer.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
Creates a list of values that conform to theUserDataDescriptorvalue descriptor, by using theuser datafrom 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 ananonymoususer.- Parameters:
submission- A form record submission from which to extract the user data.- Returns:
- A user data value conforming to
UserDataDescriptor.
-
valueUserData
Creates a value that conforms to theUserDataDescriptorvalue descriptor. When the user is null, the user data for ananonymoususer are returned.- Parameters:
user- The user with the user data.- Returns:
- A user data value conforming to
UserDataDescriptor.
-
valueUserData
Creates a value that conforms to theUserDataDescriptorvalue 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 ananonymoususer are returned.- Parameters:
user- The user with the user data.client- Optional client scope.- Returns:
- A user data value conforming to
UserDataDescriptor.
-