Class Customer
- java.lang.Object
-
- com.broadleafcommerce.customer.domain.Customer
-
- All Implemented Interfaces:
com.broadleafcommerce.data.tracking.core.ContextStateAware,com.broadleafcommerce.data.tracking.core.policy.Owned,Serializable
public class Customer extends Object implements com.broadleafcommerce.data.tracking.core.ContextStateAware, com.broadleafcommerce.data.tracking.core.policy.Owned, Serializable
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description Customer()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CustomeraddAttribute(String key, Object value)Convenience method to add an ann attribute.protected booleancanEqual(Object other)booleanequals(Object o)List<AdditionalPhone>getAdditionalPhones()Additional phone numbers associated with the customer.<T> TgetAttribute(String key)Map<String,Object>getAttributes()Dynamic attributes that are a part of the customer.com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextStategetContextState()A subset ofTrackinginformation to expose the context state for this object.StringgetDefaultPaymentAccountId()The id of the default payment account.StringgetEmail()The email address of the customer.StringgetExternalId()The id that associates this user with an external system.StringgetFirstName()The first name of the customer, if the fullName is not being used for the customer.StringgetFullName()The full name of the customer, if the component parts firstName, middleName, and lastName are not being used to comprise the full name.StringgetId()The context ID of the customer.StringgetLastName()The last name of the customer, if the fullName is not being used for the customer.StringgetMiddleName()The middle name of the customer, if the fullName is not being used for the customer.StringgetName()Get the name of the customer.StringgetOwnerIdentifier()PhonegetPhone()The main phone number of the customer.StringgetSpecialType()The type of the customer, if it's in a special circumstance.StringgetUsername()The username of the customer, used to log in.inthashCode()booleanisActive()Is this customer active? Inactive customers can be thought of as "disabled" and will not be able to login.booleanisLocked()Is this user locked? A user may be locked due to too many failed login attempts.voidsetActive(boolean active)Is this customer active? Inactive customers can be thought of as "disabled" and will not be able to login.voidsetAdditionalPhones(List<AdditionalPhone> additionalPhones)Additional phone numbers associated with the customer.voidsetAttributes(Map<String,Object> attributes)Dynamic attributes that are a part of the customer.voidsetContextState(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState)A subset ofTrackinginformation to expose the context state for this object.voidsetDefaultPaymentAccountId(String defaultPaymentAccountId)The id of the default payment account.voidsetEmail(String email)The email address of the customer.voidsetExternalId(String externalId)The id that associates this user with an external system.voidsetFirstName(String firstName)The first name of the customer, if the fullName is not being used for the customer.voidsetFullName(String fullName)The full name of the customer, if the component parts firstName, middleName, and lastName are not being used to comprise the full name.voidsetId(String id)The context ID of the customer.voidsetLastName(String lastName)The last name of the customer, if the fullName is not being used for the customer.voidsetLocked(boolean locked)Is this user locked? A user may be locked due to too many failed login attempts.voidsetMiddleName(String middleName)The middle name of the customer, if the fullName is not being used for the customer.voidsetPhone(Phone phone)The main phone number of the customer.voidsetSpecialType(String specialType)The type of the customer, if it's in a special circumstance.voidsetUsername(String username)The username of the customer, used to log in.StringtoString()
-
-
-
Method Detail
-
getName
public String getName()
Get the name of the customer. This will provide either the full name, or the combined first, middle, and last names.fullNametakes priority. Whether a single name or multiple name fields are used is a client implementation detail.- Returns:
- The name of the customer.
-
addAttribute
public Customer addAttribute(String key, Object value)
Convenience method to add an ann attribute.If the attribute already exists, the existing attribute is overwritten.
- Parameters:
key- The key used to store/retrieve the attribute.value- The value to store.- Returns:
- The customer instance
- See Also:
getAttribute(String),getAttributes()
-
getAttribute
public <T> T getAttribute(String key)
-
getOwnerIdentifier
public String getOwnerIdentifier()
- Specified by:
getOwnerIdentifierin interfacecom.broadleafcommerce.data.tracking.core.policy.Owned
-
getId
public String getId()
The context ID of the customer.- Returns:
- the context ID of the customer
-
getFirstName
public String getFirstName()
The first name of the customer, if the fullName is not being used for the customer.- Returns:
- the first name of the customer
-
getMiddleName
public String getMiddleName()
The middle name of the customer, if the fullName is not being used for the customer.- Returns:
- the middle name of the customer
-
getLastName
public String getLastName()
The last name of the customer, if the fullName is not being used for the customer.- Returns:
- the last name of the customer
-
getFullName
public String getFullName()
The full name of the customer, if the component parts firstName, middleName, and lastName are not being used to comprise the full name.- Returns:
- the full name of the customer
-
getUsername
public String getUsername()
The username of the customer, used to log in.- Returns:
- the username of the customer
-
getEmail
public String getEmail()
The email address of the customer.- Returns:
- the email address of the customer
-
getExternalId
public String getExternalId()
The id that associates this user with an external system.- Returns:
- The customer's external ID
-
getPhone
public Phone getPhone()
The main phone number of the customer.- Returns:
- the main phone number of the customer
-
getAdditionalPhones
public List<AdditionalPhone> getAdditionalPhones()
Additional phone numbers associated with the customer.- Returns:
- additional phone numbers associated with the customer
-
getDefaultPaymentAccountId
public String getDefaultPaymentAccountId()
The id of the default payment account.- Returns:
- defaultAccountId the default payment account of the customer
-
getAttributes
public Map<String,Object> getAttributes()
Dynamic attributes that are a part of the customer. This is an admin-entered field.- Returns:
- dynamic attributes that are a part of the customer
-
getSpecialType
public String getSpecialType()
The type of the customer, if it's in a special circumstance.- Returns:
- The type of the customer, if it's in a special circumstance.
- See Also:
CustomerSpecialType
-
isActive
public boolean isActive()
Is this customer active? Inactive customers can be thought of as "disabled" and will not be able to login. A customer set to inactive must be manually re-activated.Note: If manually setting this to false (e.g. via a direct database update), the auth user record (JpaUser#active in the auth database) must also be set to false.
See also
locked- Returns:
- Is this customer active?
-
getContextState
public com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState getContextState()
A subset ofTrackinginformation to expose the context state for this object.- Specified by:
getContextStatein interfacecom.broadleafcommerce.data.tracking.core.ContextStateAware- Returns:
- a subset of
Trackinginformation to expose the context state for this object.
-
isLocked
public boolean isLocked()
Is this user locked? A user may be locked due to too many failed login attempts. Note that, depending on user lock configuration, this may have no effect. If permanently disabling a customer is desired, theactiveflag should be used instead.- Returns:
- is this customer locked?
-
setId
public void setId(String id)
The context ID of the customer.- Parameters:
id- the context ID of the customer
-
setFirstName
public void setFirstName(String firstName)
The first name of the customer, if the fullName is not being used for the customer.- Parameters:
firstName- the first name of the customer
-
setMiddleName
public void setMiddleName(String middleName)
The middle name of the customer, if the fullName is not being used for the customer.- Parameters:
middleName- the middle name of the customer
-
setLastName
public void setLastName(String lastName)
The last name of the customer, if the fullName is not being used for the customer.- Parameters:
lastName- the last name of the customer
-
setFullName
public void setFullName(String fullName)
The full name of the customer, if the component parts firstName, middleName, and lastName are not being used to comprise the full name.- Parameters:
fullName- the full name of the customer
-
setUsername
public void setUsername(String username)
The username of the customer, used to log in.- Parameters:
username- the username of the customer
-
setEmail
public void setEmail(String email)
The email address of the customer.- Parameters:
email- the email address of the customer
-
setExternalId
public void setExternalId(String externalId)
The id that associates this user with an external system.- Parameters:
externalId- The customer's external ID
-
setPhone
public void setPhone(Phone phone)
The main phone number of the customer.- Parameters:
phone- the main phone number of the customer
-
setAdditionalPhones
public void setAdditionalPhones(List<AdditionalPhone> additionalPhones)
Additional phone numbers associated with the customer.- Parameters:
additionalPhones- additional phone numbers associated with the customer
-
setDefaultPaymentAccountId
public void setDefaultPaymentAccountId(String defaultPaymentAccountId)
The id of the default payment account.- Parameters:
defaultAccountId- the default payment account of the customer
-
setAttributes
public void setAttributes(Map<String,Object> attributes)
Dynamic attributes that are a part of the customer. This is an admin-entered field.- Parameters:
attributes- dynamic attributes that are a part of the customer
-
setSpecialType
public void setSpecialType(String specialType)
The type of the customer, if it's in a special circumstance.- Parameters:
type- The type of the customer, if it's in a special circumstance.- See Also:
CustomerSpecialType
-
setActive
public void setActive(boolean active)
Is this customer active? Inactive customers can be thought of as "disabled" and will not be able to login. A customer set to inactive must be manually re-activated.Note: If manually setting this to false (e.g. via a direct database update), the auth user record (JpaUser#active in the auth database) must also be set to false.
See also
locked- Parameters:
active- Is this customer active?
-
setContextState
public void setContextState(com.broadleafcommerce.data.tracking.core.filtering.business.domain.ContextState contextState)
A subset ofTrackinginformation to expose the context state for this object.- Specified by:
setContextStatein interfacecom.broadleafcommerce.data.tracking.core.ContextStateAware- Parameters:
contextState- a subset ofTrackinginformation to expose the context state for this object
-
setLocked
public void setLocked(boolean locked)
Is this user locked? A user may be locked due to too many failed login attempts. Note that, depending on user lock configuration, this may have no effect. If permanently disabling a customer is desired, theactiveflag should be used instead.- Parameters:
locked- is this customer locked?
-
canEqual
protected boolean canEqual(Object other)
-
-