Package org.silverpeas.components.questionreply.web

## Class AuthorEntity

- java.lang.Object
- - org.silverpeas.components.questionreply.web.AuthorEntity

- All Implemented Interfaces:
    `Serializable`

      public class AuthorEntity
      extends Object
      implements Serializable

  The entity representing the author of a comment. It is a user that has written a comment and that is exposed in the web as an entity (a web entity). As such, it publishes only some of its attributes.
  See Also:
    Serialized Form

- - ### Constructor Summary

    Constructors
    Modifier | Constructor | Description
    --- | --- | ---
    `protected` | `AuthorEntity()` | Creates an empty comment author.

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `boolean` | `equals​(Object obj)` |
    `static AuthorEntity` | `fromUser​(org.silverpeas.core.admin.user.model.UserDetail user)` | Creates a new comment author entity from the specified user.
    `String` | `getAvatar()` | Gets the relative path of the user avatar.
    `String` | `getFullName()` | Gets the full name of the author (both the first name and the last name).
    `String` | `getId()` | Gets the unique identifier of the author.
    `String` | `getLanguage()` | Gets the preferred language of the author.
    `org.silverpeas.core.personalization.UserPreferences` | `getUserPreferences()` | Gets the preference of this author.
    `int` | `hashCode()` |
    `void` | `setAvatar​(String avatarURL)` | Sets the URL at which is located the user's avatar.
    `org.silverpeas.core.admin.user.model.UserDetail` | `toUser()` | Gets a user detail from this entity.

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

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AuthorEntity

          protected AuthorEntity()

      Creates an empty comment author.

  - ### Method Detail

    - #### fromUser

          public static AuthorEntity fromUser​(org.silverpeas.core.admin.user.model.UserDetail user)

      Creates a new comment author entity from the specified user.
      Parameters:
        `user` - the user to entitify.
      Returns:
        the comment writer.

    - #### getAvatar

          public String getAvatar()

      Gets the relative path of the user avatar.
      Returns:
        the relative path of the URI referring the user avatar.

    - #### setAvatar

          public void setAvatar​(String avatarURL)

      Sets the URL at which is located the user's avatar.
      Parameters:
        `avatarURL` - the URL of the user's avatar.

    - #### getId

          public String getId()

      Gets the unique identifier of the author.
      Returns:
        the user identifier.

    - #### getFullName

          public String getFullName()

      Gets the full name of the author (both the first name and the last name).
      Returns:
        the user full name.

    - #### getLanguage

          public String getLanguage()

      Gets the preferred language of the author.
      Returns:
        the language code of the author according to the ISO 639-1 standard (for example "fr" for french).

    - #### equals

          public boolean equals​(Object obj)

      Overrides:
        `equals` in class `Object`

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `Object`

    - #### toUser

          public org.silverpeas.core.admin.user.model.UserDetail toUser()

      Gets a user detail from this entity.
      Returns:
        a UserDetail instance.

    - #### getUserPreferences

          public final org.silverpeas.core.personalization.UserPreferences getUserPreferences()

      Gets the preference of this author.
      Returns:
        the preferences of the user or null if its preferences cannot be retrieved.