Class UserUtil

java.lang.Object
com.ssgllc.fish.service.util.registered.UserUtil

@Component public final class UserUtil extends Object
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 Details

    • UserUtil

      public UserUtil()
  • Method Details

    • getUserFromId

      public static com.ssgllc.fish.bpm.domain.BpmUser getUserFromId(String id)
      Returns the user with the given id.
      Parameters:
      id - the user's id
      Returns:
      the user, or null if 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

      public static String getUserIdByLogin(String login)
      Returns the id of the user with the given login. The inverse of getUserFromId(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 null if 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"