Class UserUtil
java.lang.Object
com.ssgllc.fish.service.util.registered.UserUtil
User lookups against the user cache.
Both methods read the cache rather than the database, so they are cheap enough to call from a calculated field or a validation.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic com.ssgllc.fish.bpm.domain.BpmUsergetUserFromId(String id) Returns the user with the given id.static StringgetUserIdByLogin(String login) Returns the id of the user with the given login.
-
Constructor Details
-
UserUtil
public UserUtil()
-
-
Method Details
-
getUserFromId
Returns the user with the given id.- Parameters:
id- the user's id- Returns:
- the user, or
nullif no user has that id
Groovy example:
def assignee = userUtil.getUserFromId(entity.assignedToId)
return assignee?.email
Returns:
the assignee's email address
SpEL example:
#getUserFromId(#assignedToId)?.login
Returns:
"jdoe"
-
getUserIdByLogin
Returns the id of the user with the given login. The inverse ofgetUserFromId(String), for when configuration names a user by login rather than carrying an id.- Parameters:
login- the user's login- Returns:
- the user's id, or
nullif no user has that login
Groovy example:
def supervisorId = userUtil.getUserIdByLogin("supervisor")
Returns:
the supervisor's id, for assigning a task or setting a reference field
SpEL example:
#getUserIdByLogin("supervisor")
Returns:
"3f2b1c8e-5d44-4a91-9f10-7c2e5b8a1d33"
-