Package com.logicaldoc.core.automation

# Class UserTool

java.lang.Object
com.logicaldoc.core.automation.UserTool

public class UserTool extends Object
Utility methods to handle some user related operations from within the Automation

Since:
  8.6.1
Author:
  Meschieri - LogicalDOC

## Constructor Summary

Constructors
Constructor
Description
`UserTool()`

## Method Summary

Modifier and Type
Method
Description
`String`
`getAvatar(String username)`
Generates and retrieves the avatar image for a given user
`String`
`getAvatarImg(long userId, int size)`
Generates the HTML img tag for displaying an avatar
`String`
`getAvatarImg(String username, int size)`
Generates the HTML img tag for displaying an avatar
`User`
`getUser(long userId)`
Retrieves a user object
`User`
`getUser(String username)`
Retrieves a user object
`void`
`initialize(User user)`
Initializes lazy loaded collections

### Methods inherited from class java.lang.Object

`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### UserTool

public UserTool()

## Method Details

### getUser

public User getUser(String username)
Retrieves a user object

Parameters:
  `username` - the username
Returns:
  the user object

### getUser

public User getUser(long userId)
Retrieves a user object

Parameters:
  `userId` - the user ID
Returns:
  the user object

### initialize

public void initialize(User user)
Initializes lazy loaded collections

Parameters:
  `user` - the user to initialize

### getAvatar

public String getAvatar(String username)
Generates and retrieves the avatar image for a given user

Parameters:
  `username` - username of the user
Returns:
  the avatar in Base64

### getAvatarImg

public String getAvatarImg(String username, int size)
Generates the HTML img tag for displaying an avatar

Parameters:
  `username` - username of the user
  `size` - image size
Returns:
  the avatar in Base64

### getAvatarImg

public String getAvatarImg(long userId, int size)
Generates the HTML img tag for displaying an avatar

Parameters:
  `userId` - identifier of the user
  `size` - image size
Returns:
  the avatar in Base64