Class UserImpl

Object
com.liferay.portal.kernel.model.impl.BaseModelImpl<com.liferay.portal.kernel.model.User>
All Implemented Interfaces:
com.liferay.portal.kernel.model.BaseModel<com.liferay.portal.kernel.model.User>, com.liferay.portal.kernel.model.change.tracking.CTModel<com.liferay.portal.kernel.model.User>, com.liferay.portal.kernel.model.ClassedModel, com.liferay.portal.kernel.model.ExternalReferenceCodeModel, com.liferay.portal.kernel.model.MVCCModel, com.liferay.portal.kernel.model.PersistedModel, com.liferay.portal.kernel.model.ShardedModel, com.liferay.portal.kernel.model.StagedModel, com.liferay.portal.kernel.model.User, com.liferay.portal.kernel.model.UserModel, Serializable, Cloneable, Comparable<com.liferay.portal.kernel.model.User>

public class UserImpl extends UserBaseImpl
Represents a portal user, providing access to the user's contact information, groups, organizations, teams, user groups, roles, locale, timezone, and more.
Author:
Brian Wing Shun Chan, Jorge Ferrer, Wesley Gong
See Also:
  • Constructor Details

    • UserImpl

      public UserImpl()
  • Method Details

    • fetchContact

      public com.liferay.portal.kernel.model.Contact fetchContact()
    • fetchPortraitURL

      public String fetchPortraitURL(com.liferay.portal.kernel.theme.ThemeDisplay themeDisplay)
    • getAddresses

      public List<com.liferay.portal.kernel.model.Address> getAddresses()
      Returns the user's addresses.
      Returns:
      the user's addresses
    • getAllGroups

      public List<com.liferay.portal.kernel.model.Group> getAllGroups() throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getAllRoles

      public List<com.liferay.portal.kernel.model.Role> getAllRoles() throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getBirthday

      public Date getBirthday() throws com.liferay.portal.kernel.exception.PortalException
      Returns the user's birth date.
      Returns:
      the user's birth date
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getCompanyMx

      public String getCompanyMx() throws com.liferay.portal.kernel.exception.PortalException
      Returns the user's company's mail domain.
      Returns:
      the user's company's mail domain
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getContact

      public com.liferay.portal.kernel.model.Contact getContact() throws com.liferay.portal.kernel.exception.PortalException
      Returns the user's associated contact.
      Returns:
      the user's associated contact
      Throws:
      com.liferay.portal.kernel.exception.PortalException
      See Also:
      • Contact
    • getDigest

      @Deprecated public String getDigest(String password)
      Deprecated.
      As of Cavanaugh (7.4.x), with no direct replacement
      Returns a digest for the user, incorporating the password.
      Parameters:
      password - a password to incorporate with the digest
      Returns:
      a digest for the user, incorporating the password
    • getDisplayEmailAddress

      public String getDisplayEmailAddress()
      Returns the user's primary email address, or a blank string if the address is fake.
      Returns:
      the user's primary email address, or a blank string if the address is fake
    • getDisplayURL

      public String getDisplayURL(com.liferay.portal.kernel.theme.ThemeDisplay themeDisplay) throws com.liferay.portal.kernel.exception.PortalException
      Returns the user's display URL based on the theme display, discounting the URL of the user's default intranet site home page.

      The logic for the display URL to return is as follows:

      1. If the user is the guest user, return an empty string.
      2. Else, if a friendly URL is available for the user's profile, return that friendly URL.
      3. Otherwise, return the URL of the user's default extranet site home page.
      Parameters:
      themeDisplay - the theme display
      Returns:
      the user's display URL
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getDisplayURL

      public String getDisplayURL(com.liferay.portal.kernel.theme.ThemeDisplay themeDisplay, boolean privateLayout) throws com.liferay.portal.kernel.exception.PortalException
      Returns the user's display URL based on the theme display.

      The logic for the display URL to return is as follows:

      1. If the user is the guest user, return an empty string.
      2. Else, if a friendly URL is available for the user's profile, return that friendly URL.
      3. Else, if privateLayout is true, return the URL of the user's default intranet site home page.
      4. Otherwise, return the URL of the user's default extranet site home page.
      Parameters:
      themeDisplay - the theme display
      privateLayout - whether to use the URL of the user's default intranet (versus extranet) site home page, if no friendly URL is available for the user's profile
      Returns:
      the user's display URL
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getEmailAddresses

      public List<com.liferay.portal.kernel.model.EmailAddress> getEmailAddresses()
      Returns the user's email addresses.
      Returns:
      the user's email addresses
    • getFemale

      public boolean getFemale() throws com.liferay.portal.kernel.exception.PortalException
      Returns true if the user is female.
      Returns:
      true if the user is female; false otherwise
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getFullName

      @AutoEscape public String getFullName()
      Returns the user's full name.
      Returns:
      the user's full name
    • getFullName

      @AutoEscape public String getFullName(boolean usePrefix, boolean useSuffix)
      Returns the user's full name.
      Returns:
      the user's full name
    • getGroup

      public com.liferay.portal.kernel.model.Group getGroup()
    • getGroupId

      public long getGroupId()
      Specified by:
      getGroupId in interface com.liferay.portal.kernel.model.User
      Overrides:
      getGroupId in class UserModelImpl
    • getGroupIds

      public long[] getGroupIds()
    • getGroups

      public List<com.liferay.portal.kernel.model.Group> getGroups()
    • getInheritedGroups

      public List<com.liferay.portal.kernel.model.Group> getInheritedGroups() throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getInheritedRoles

      public List<com.liferay.portal.kernel.model.Role> getInheritedRoles() throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getInheritedSiteGroups

      public List<com.liferay.portal.kernel.model.Group> getInheritedSiteGroups() throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getInheritedSiteRoles

      public List<com.liferay.portal.kernel.model.Role> getInheritedSiteRoles()
    • getInitials

      public String getInitials()
    • getLocale

      public Locale getLocale()
    • getLogin

      public String getLogin() throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getMale

      public boolean getMale() throws com.liferay.portal.kernel.exception.PortalException
      Returns true if the user is male.
      Returns:
      true if the user is male; false otherwise
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getMySiteGroups

      public List<com.liferay.portal.kernel.model.Group> getMySiteGroups() throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getMySiteGroups

      public List<com.liferay.portal.kernel.model.Group> getMySiteGroups(int max) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getMySiteGroups

      public List<com.liferay.portal.kernel.model.Group> getMySiteGroups(String[] classNames, int max) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getOrganizationIds

      public long[] getOrganizationIds() throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getOrganizationIds

      public long[] getOrganizationIds(boolean includeAdministrative) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getOrganizations

      public List<com.liferay.portal.kernel.model.Organization> getOrganizations() throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getOrganizations

      public List<com.liferay.portal.kernel.model.Organization> getOrganizations(boolean includeAdministrative) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getOrganizations

      public List<com.liferay.portal.kernel.model.Organization> getOrganizations(boolean includeAdministrative, boolean includeParentOrganizations) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getOrganizationsGroups

      public List<com.liferay.portal.kernel.model.Group> getOrganizationsGroups() throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getOrganizationsRoles

      public List<com.liferay.portal.kernel.model.Role> getOrganizationsRoles() throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getOriginalEmailAddress

      public String getOriginalEmailAddress()
      Specified by:
      getOriginalEmailAddress in interface com.liferay.portal.kernel.model.User
      Overrides:
      getOriginalEmailAddress in class UserModelImpl
    • getPasswordModified

      public boolean getPasswordModified()
    • getPasswordPolicy

      public com.liferay.portal.kernel.model.PasswordPolicy getPasswordPolicy() throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getPasswordUnencrypted

      public String getPasswordUnencrypted()
    • getPhones

      public List<com.liferay.portal.kernel.model.Phone> getPhones()
    • getPortraitURL

      public String getPortraitURL(com.liferay.portal.kernel.theme.ThemeDisplay themeDisplay) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getPrivateLayoutsPageCount

      public int getPrivateLayoutsPageCount() throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getPublicLayoutsPageCount

      public int getPublicLayoutsPageCount() throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getReminderQueryQuestions

      public Set<String> getReminderQueryQuestions() throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getRoleIds

      public long[] getRoleIds()
    • getRoles

      public List<com.liferay.portal.kernel.model.Role> getRoles()
    • getSiteGroups

      public List<com.liferay.portal.kernel.model.Group> getSiteGroups() throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getSiteGroups

      public List<com.liferay.portal.kernel.model.Group> getSiteGroups(boolean includeAdministrative) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getSiteRoles

      public List<com.liferay.portal.kernel.model.Role> getSiteRoles() throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getTeamIds

      public long[] getTeamIds()
    • getTeams

      public List<com.liferay.portal.kernel.model.Team> getTeams()
    • getTimeZone

      public TimeZone getTimeZone()
    • getUnlockDate

      public Date getUnlockDate() throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getUnlockDate

      public Date getUnlockDate(com.liferay.portal.kernel.model.PasswordPolicy passwordPolicy)
    • getUserGroupIds

      public long[] getUserGroupIds()
    • getUserGroupRoles

      public List<com.liferay.portal.kernel.model.UserGroupRole> getUserGroupRoles() throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • getUserGroups

      public List<com.liferay.portal.kernel.model.UserGroup> getUserGroups()
    • getWebsites

      public List<com.liferay.portal.kernel.model.Website> getWebsites()
    • hasCompanyMx

      public boolean hasCompanyMx() throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • hasCompanyMx

      public boolean hasCompanyMx(String emailAddress) throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • hasMySites

      public boolean hasMySites() throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • hasOrganization

      public boolean hasOrganization()
    • hasPrivateLayouts

      public boolean hasPrivateLayouts() throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • hasPublicLayouts

      public boolean hasPublicLayouts() throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • hasReminderQuery

      public boolean hasReminderQuery()
    • isActive

      public boolean isActive()
    • isDefaultUser

      @Deprecated public boolean isDefaultUser()
      Deprecated.
      As of Cavanaugh (7.4.x), replaced by isGuestUser()
    • isEmailAddressComplete

      public boolean isEmailAddressComplete()
    • isEmailAddressVerificationComplete

      public boolean isEmailAddressVerificationComplete()
    • isFemale

      public boolean isFemale() throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • isGuestUser

      public boolean isGuestUser()
    • isMale

      public boolean isMale() throws com.liferay.portal.kernel.exception.PortalException
      Throws:
      com.liferay.portal.kernel.exception.PortalException
    • isOnDemandUser

      public boolean isOnDemandUser()
    • isPasswordModified

      public boolean isPasswordModified()
    • isPasswordResetRequired

      public boolean isPasswordResetRequired()
    • isReminderQueryComplete

      public boolean isReminderQueryComplete()
    • isServiceAccountUser

      public boolean isServiceAccountUser()
    • isSetupComplete

      public boolean isSetupComplete()
    • isTermsOfUseComplete

      public boolean isTermsOfUseComplete()
    • setContact

      public void setContact(com.liferay.portal.kernel.model.Contact contact)
    • setDigest

      @Deprecated public void setDigest(String digest)
      Deprecated.
      As of Cavanaugh (7.4.x), with no direct replacement
      Sets the user's digest.
      Specified by:
      setDigest in interface com.liferay.portal.kernel.model.UserModel
      Overrides:
      setDigest in class UserModelImpl
    • setGroup

      public void setGroup(com.liferay.portal.kernel.model.Group group)
    • setGroupId

      public void setGroupId(long groupId)
      Specified by:
      setGroupId in interface com.liferay.portal.kernel.model.User
      Overrides:
      setGroupId in class UserModelImpl
    • setGroupIds

      public void setGroupIds(long[] groupIds)
    • setLanguageId

      public void setLanguageId(String languageId)
      Specified by:
      setLanguageId in interface com.liferay.portal.kernel.model.UserModel
      Overrides:
      setLanguageId in class UserModelImpl
    • setOrganizationIds

      public void setOrganizationIds(long[] organizationIds)
    • setPasswordModified

      public void setPasswordModified(boolean passwordModified)
    • setPasswordUnencrypted

      public void setPasswordUnencrypted(String passwordUnencrypted)
    • setRoleIds

      public void setRoleIds(long[] roleIds)
    • setTeamIds

      public void setTeamIds(long[] teamIds)
    • setTimeZoneId

      public void setTimeZoneId(String timeZoneId)
      Specified by:
      setTimeZoneId in interface com.liferay.portal.kernel.model.UserModel
      Overrides:
      setTimeZoneId in class UserModelImpl
    • setUserGroupIds

      public void setUserGroupIds(long[] userGroupIds)
    • getProfileFriendlyURL

      protected String getProfileFriendlyURL()