Class JpaUser
- 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 aUser.- Author:
- Nathan Moore (nathanmoore)., Samarth Dhruva (samarthd)
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description JpaUser()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleancanEqual(Object other)booleanequals(Object o)org.modelmapper.ModelMapperfromMe()Set<String>getApplicationIds()Map<String,Object>getAttributes()Class<?>getBusinessDomainType()StringgetCustomerContextId()StringgetEmail()StringgetExternalId()StringgetFirstName()StringgetFullName()StringgetId()StringgetLastName()InstantgetLastUpdated()We don't useLastModifiedDatehere because we want to enable manually setting this value (ex: for setting the lastUpdated to a value received in a persistence message).InstantgetLockedTime()StringgetMiddleName()StringgetPassword()Set<JpaUserPermission>getPermissions()StringgetPlainPassword()Set<JpaUserRestrictedPermission>getRestrictedPermissions()Set<JpaUserRestrictedRole>getRestrictedRoles()Set<JpaUserRestriction>getRestrictions()Set<JpaUserRole>getRoles()StringgetServerId()StringgetServiceId()StringgetTenantId()StringgetType()StringgetUsername()inthashCode()booleanisActive()booleanisApplicationAccess()booleanisArchived()booleanisChangePasswordRequired()booleanisExpired()booleanisImpersonationAllowed()booleanisLocked()booleanisTenantAccess()protected UserpruneArchivedReferences(org.modelmapper.spi.MappingContext<JpaUser,User> mappingContext)Used as theTypeMap.setPostConverter(Converter)forfromMe().voidsetActive(boolean active)voidsetApplicationAccess(boolean applicationAccess)voidsetApplicationIds(Set<String> applicationIds)voidsetArchived(boolean archived)voidsetAttributes(Map<String,Object> attributes)voidsetChangePasswordRequired(boolean changePasswordRequired)voidsetCustomerContextId(String customerContextId)voidsetEmail(String email)voidsetExpired(boolean expired)voidsetExternalId(String externalId)voidsetFirstName(String firstName)voidsetFullName(String fullName)voidsetId(String id)voidsetImpersonationAllowed(boolean impersonationAllowed)voidsetLastName(String lastName)voidsetLastUpdated(Instant lastUpdated)We don't useLastModifiedDatehere because we want to enable manually setting this value (ex: for setting the lastUpdated to a value received in a persistence message).voidsetLocked(boolean locked)voidsetLockedTime(Instant lockedTime)voidsetMiddleName(String middleName)voidsetPassword(String password)voidsetPermissions(Set<JpaUserPermission> permissions)voidsetPlainPassword(String plainPassword)voidsetRestrictedPermissions(Set<JpaUserRestrictedPermission> restrictedPermissions)voidsetRestrictedRoles(Set<JpaUserRestrictedRole> restrictedRoles)voidsetRestrictions(Set<JpaUserRestriction> restrictions)voidsetRoles(Set<JpaUserRole> roles)voidsetServerId(String serverId)voidsetServiceId(String serviceId)voidsetTenantAccess(boolean tenantAccess)voidsetTenantId(String tenantId)voidsetType(String type)voidsetUsername(String username)org.modelmapper.ModelMappertoMe()protected <U extends User,J extends JpaUser>
JtoMeParentUserBackReferenceAdder(org.modelmapper.spi.MappingContext<U,J> mappingContext)StringtoString()
-
-
-
Method Detail
-
fromMe
public org.modelmapper.ModelMapper fromMe()
- Specified by:
fromMein interfacecom.broadleafcommerce.data.tracking.core.mapping.ModelMapperMappable
-
pruneArchivedReferences
protected User pruneArchivedReferences(org.modelmapper.spi.MappingContext<JpaUser,User> mappingContext)
Used as theTypeMap.setPostConverter(Converter)forfromMe().JPA will eagerly fetch
rolesandpermissionsif 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:
toMein interfacecom.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 theTypeMap.setPostConverter(Converter)forJpaUserintoMe().For each of the parent-user back-references in managed collections like
getRestrictions(),getRestrictedRoles(), andgetRestrictedPermissions(), 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:
getBusinessDomainTypein interfacecom.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
-
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
-
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 useLastModifiedDatehere 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()
-
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
-
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
-
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 useLastModifiedDatehere 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)
-
canEqual
protected boolean canEqual(Object other)
-
-