Class UserDataDescriptor
- java.lang.Object
-
- de.xima.fc.workflow.processor.value.wrapper.RecordValueDescriptorWrapper
-
- de.xima.fc.workflow.processor.value.common.UserDataDescriptor
-
- All Implemented Interfaces:
IRecordValueDescriptor
,IValueDescriptor<Map<String,?>,IRecordValueBuilder>
,Serializable
public final class UserDataDescriptor extends RecordValueDescriptorWrapper
AIValueDescriptor
for the data of auser
. The structure of the data is the same for example the system placeholder[%$USER%]
. See alsoUserMgmtUtils.toJson(IUser)
.- See Also:
- Serialized Form
-
-
Field Summary
-
Fields inherited from class de.xima.fc.workflow.processor.value.wrapper.RecordValueDescriptorWrapper
delegate
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Map<String,Object>
valueUserData(FormRecordSubmission submission)
Creates a list of values that conform to theUserDataDescriptor
value descriptor, by using theuser data
from the given form record submission.static Map<String,Object>
valueUserData(IUser user)
Creates a value that conforms to theUserDataDescriptor
value descriptor.static Map<String,Object>
valueUserData(IUser user, Mandant client)
Creates a value that conforms to theUserDataDescriptor
value descriptor.static List<Map<String,Object>>
valueUserData(Iterable<String> userReferences, Iterable<UserProfile> userProfiles, Iterable<FormRecordSubmission> submissions)
Creates a list of values that conform to theUserDataDescriptor
value descriptor from the given universal user references, by resolving the references against the given list user profiles and form record submissions.static Map<String,Object>
valueUserData(String userReference, UserProfile profile)
Creates a value that conforms to theUserDataDescriptor
value descriptor, using the data form the given user profile.static Map<String,Object>
valueUserData(String userReference, UserProfile userProfile, Iterable<FormRecordSubmission> submissions)
Creates a value that conforms to theUserDataDescriptor
value descriptor from the given universal user reference, by resolving the reference against the given list user profiles and form record submissions.static Map<String,Object>
valueUserData(Map<String,?> userData)
Creates a value that conforms to theUserDataDescriptor
value descriptor.-
Methods inherited from class de.xima.fc.workflow.processor.value.wrapper.RecordValueDescriptorWrapper
acceptsValue, asAny, asBoolean, asConst, asFloat, asInteger, asLargeString, asList, asList, asMap, asMap, asNull, asRecord, asString, asTuple, asUnion, asUnion, asVoid, builder, configure, getBaseType, getDefaultValue, getDescription, getFullType, getJavaClass, getKnownProperties, getKnownProperties, getRecordValueDescriptors, intersect, is, toString, unwrap, withDefaultValue, withDescription
-
-
-
-
Method Detail
-
valueUserData
public static Map<String,Object> valueUserData(Map<String,?> userData)
Creates a value that conforms to theUserDataDescriptor
value descriptor. When the user data is null, the user data for ananonymous
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 theUserDataDescriptor
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 profile)
Creates a value that conforms to theUserDataDescriptor
value descriptor, using the data form the given user profile. When the user data is null, the user data for ananonymous
user is returned.- Parameters:
userReference
- Theuniversal reference ID
of 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 theUserDataDescriptor
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 theUserDataDescriptor
value descriptor, by using theuser 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 ananonymous
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 theUserDataDescriptor
value descriptor. When the user is null, the user data for ananonymous
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 theUserDataDescriptor
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 ananonymous
user are returned.- Parameters:
user
- The user with the user data.client
- Optional client scope.- Returns:
- A user data value conforming to
UserDataDescriptor
.
-
-