java.lang.Object
com.broadleafcommerce.auth.user.provider.jpa.domain.JpaUser
All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.mapping.BusinessTypeAware, com.broadleafcommerce.data.tracking.core.mapping.ModelMapperMappable, Serializable

@Entity public class JpaUser extends Object implements Serializable, com.broadleafcommerce.data.tracking.core.mapping.ModelMapperMappable, com.broadleafcommerce.data.tracking.core.mapping.BusinessTypeAware
Persisted counterpart for a User.
Author:
Nathan Moore (nathanmoore)., Samarth Dhruva (samarthd)
See Also:
  • Constructor Details

    • JpaUser

      public JpaUser()
  • Method Details

    • fromMe

      public org.modelmapper.ModelMapper fromMe()
      Specified by:
      fromMe in interface com.broadleafcommerce.data.tracking.core.mapping.ModelMapperMappable
    • pruneArchivedReferences

      protected User pruneArchivedReferences(org.modelmapper.spi.MappingContext<JpaUser,User> mappingContext)
      Used as the TypeMap.setPostConverter(Converter) for fromMe().

      JPA will eagerly fetch roles and permissions if they exist in the data store, but we have a soft-deletion concept that JPA does not account for. This ensures that any references to entities that have been archived are pruned before being mapped to the business domain. This protects against those entities being usable despite being archived.

      Parameters:
      mappingContext - the model mapper mapping context
      Returns:
      the business-domain user after removing any references to archived records
    • toMe

      public org.modelmapper.ModelMapper toMe()
      Specified by:
      toMe in interface com.broadleafcommerce.data.tracking.core.mapping.ModelMapperMappable
    • toMeParentUserBackReferenceAdder

      protected <U extends User, J extends JpaUser> J toMeParentUserBackReferenceAdder(org.modelmapper.spi.MappingContext<U,J> mappingContext)
      Used as the TypeMap.setPostConverter(Converter) for JpaUser in toMe().

      For each of the parent-user back-references in managed collections like getRestrictions(), getRestrictedRoles(), and getRestrictedPermissions(), explicitly sets their value to the user instance being mapped.

      As documented in TypeMap.include(Class, Class), extensions will not automatically inherit this converter, and must manually set it on the extended type map.

      Parameters:
      mappingContext - the model mapper mapping context
      Returns:
      the persisted-domain user after setting each of its managed collection items' parent references to itself
    • getBusinessDomainType

      public Class<?> getBusinessDomainType()
      Specified by:
      getBusinessDomainType in interface com.broadleafcommerce.data.tracking.core.mapping.BusinessTypeAware
    • getId

      public String getId()
    • getFirstName

      public String getFirstName()
      See Also:
      • User.firstName
    • getMiddleName

      public String getMiddleName()
      See Also:
      • User.middleName
    • getLastName

      public String getLastName()
      See Also:
      • User.lastName
    • getFullName

      public String getFullName()
      See Also:
      • User.fullName
    • getUsername

      public String getUsername()
      See Also:
      • User.username
    • getPassword

      public String getPassword()
      See Also:
      • User.password
    • getPasswordLastUpdated

      public Instant getPasswordLastUpdated()
      See Also:
    • getPasswordHistory

      public List<JpaUserHistoricalPassword> getPasswordHistory()
      See Also:
    • getPlainPassword

      public String getPlainPassword()
    • getEmail

      public String getEmail()
      See Also:
      • User.email
    • isActive

      public boolean isActive()
      See Also:
      • User.active
    • isChangePasswordRequired

      public boolean isChangePasswordRequired()
      See Also:
      • User.changePasswordRequired
    • isLocked

      public boolean isLocked()
      See Also:
      • User.locked
    • isExpired

      public boolean isExpired()
      See Also:
      • User.expired
    • isImpersonationAllowed

      public boolean isImpersonationAllowed()
      See Also:
      • User.impersonationAllowed
    • getServiceId

      public String getServiceId()
      See Also:
      • User.serviceId
    • getType

      public String getType()
      See Also:
      • User.type
    • getExternalId

      public String getExternalId()
      See Also:
      • User.externalId
    • isTenantAccess

      public boolean isTenantAccess()
      See Also:
      • User.tenantAccess
    • isApplicationAccess

      public boolean isApplicationAccess()
      See Also:
      • User.applicationAccess
    • getTenantId

      public String getTenantId()
      See Also:
      • User.tenantId
    • getApplicationIds

      public Set<String> getApplicationIds()
      See Also:
      • User.applicationIds
    • getCustomerContextId

      public String getCustomerContextId()
      See Also:
      • User.customerContextId
    • getAttributes

      public Map<String,Object> getAttributes()
      See Also:
      • User.attributes
    • getRoles

      public Set<JpaUserRole> getRoles()
      See Also:
      • User.roles
    • getPermissions

      public Set<JpaUserPermission> getPermissions()
      See Also:
      • User.permissions
    • getRestrictions

      public Set<JpaUserRestriction> getRestrictions()
      See Also:
      • User.restrictions
    • getRestrictedRoles

      public Set<JpaUserRestrictedRole> getRestrictedRoles()
      See Also:
      • User.restrictedRoles
    • getRestrictedPermissions

      public Set<JpaUserRestrictedPermission> getRestrictedPermissions()
      See Also:
      • User.restrictedPermissions
    • getServerId

      public String getServerId()
      See Also:
      • User.serverId
    • getLastUpdated

      public Instant getLastUpdated()
      We don't use LastModifiedDate here because we want to enable manually setting this value (ex: for setting the lastUpdated to a value received in a persistence message).
      See Also:
      • User.lastUpdated
    • isArchived

      public boolean isArchived()
      See Also:
      • User.archived
    • getLockedTime

      public Instant getLockedTime()
      See Also:
      • User.lockedTime
    • getAccountRoles

      public List<JpaAccountRoleXref> getAccountRoles()
      See Also:
      • User.accountRoles
    • getDefaultAccountId

      public String getDefaultAccountId()
    • setId

      public void setId(String id)
    • setFirstName

      public void setFirstName(String firstName)
      See Also:
      • User.firstName
    • setMiddleName

      public void setMiddleName(String middleName)
      See Also:
      • User.middleName
    • setLastName

      public void setLastName(String lastName)
      See Also:
      • User.lastName
    • setFullName

      public void setFullName(String fullName)
      See Also:
      • User.fullName
    • setUsername

      public void setUsername(String username)
      See Also:
      • User.username
    • setPassword

      public void setPassword(String password)
      See Also:
      • User.password
    • setPasswordLastUpdated

      public void setPasswordLastUpdated(Instant passwordLastUpdated)
      See Also:
    • setPasswordHistory

      public void setPasswordHistory(List<JpaUserHistoricalPassword> passwordHistory)
      See Also:
    • setPlainPassword

      public void setPlainPassword(String plainPassword)
    • setEmail

      public void setEmail(String email)
      See Also:
      • User.email
    • setActive

      public void setActive(boolean active)
      See Also:
      • User.active
    • setChangePasswordRequired

      public void setChangePasswordRequired(boolean changePasswordRequired)
      See Also:
      • User.changePasswordRequired
    • setLocked

      public void setLocked(boolean locked)
      See Also:
      • User.locked
    • setExpired

      public void setExpired(boolean expired)
      See Also:
      • User.expired
    • setImpersonationAllowed

      public void setImpersonationAllowed(boolean impersonationAllowed)
      See Also:
      • User.impersonationAllowed
    • setServiceId

      public void setServiceId(String serviceId)
      See Also:
      • User.serviceId
    • setType

      public void setType(String type)
      See Also:
      • User.type
    • setExternalId

      public void setExternalId(String externalId)
      See Also:
      • User.externalId
    • setTenantAccess

      public void setTenantAccess(boolean tenantAccess)
      See Also:
      • User.tenantAccess
    • setApplicationAccess

      public void setApplicationAccess(boolean applicationAccess)
      See Also:
      • User.applicationAccess
    • setTenantId

      public void setTenantId(String tenantId)
      See Also:
      • User.tenantId
    • setApplicationIds

      public void setApplicationIds(Set<String> applicationIds)
      See Also:
      • User.applicationIds
    • setCustomerContextId

      public void setCustomerContextId(String customerContextId)
      See Also:
      • User.customerContextId
    • setAttributes

      public void setAttributes(Map<String,Object> attributes)
      See Also:
      • User.attributes
    • setRoles

      public void setRoles(Set<JpaUserRole> roles)
      See Also:
      • User.roles
    • setPermissions

      public void setPermissions(Set<JpaUserPermission> permissions)
      See Also:
      • User.permissions
    • setRestrictions

      public void setRestrictions(Set<JpaUserRestriction> restrictions)
      See Also:
      • User.restrictions
    • setRestrictedRoles

      public void setRestrictedRoles(Set<JpaUserRestrictedRole> restrictedRoles)
      See Also:
      • User.restrictedRoles
    • setRestrictedPermissions

      public void setRestrictedPermissions(Set<JpaUserRestrictedPermission> restrictedPermissions)
      See Also:
      • User.restrictedPermissions
    • setServerId

      public void setServerId(String serverId)
      See Also:
      • User.serverId
    • setLastUpdated

      public void setLastUpdated(Instant lastUpdated)
      We don't use LastModifiedDate here because we want to enable manually setting this value (ex: for setting the lastUpdated to a value received in a persistence message).
      See Also:
      • User.lastUpdated
    • setArchived

      public void setArchived(boolean archived)
      See Also:
      • User.archived
    • setLockedTime

      public void setLockedTime(Instant lockedTime)
      See Also:
      • User.lockedTime
    • setAccountRoles

      public void setAccountRoles(List<JpaAccountRoleXref> accountRoles)
      See Also:
      • User.accountRoles
    • setDefaultAccountId

      public void setDefaultAccountId(String defaultAccountId)
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object