Interface User
- All Superinterfaces:
BusinessObject
- All Known Implementing Classes:
UserBean
Interface representing an end user accessing the system. In particular,
either a customer using the user interface to shop for and purchase products
or an administrator configuring the store's administrative settings.
An instance implementing User
is created on the first request
of a user's session and is stored along with that session for as long as the
user continues to access the application. It is stored as a session attribute
named "user".
When the application needs to create an instance that implements
User
,
BusinessObjectFactory
finds the name of the Java class to instantiate from the "userImplementer"
setting in the appComponents.properties
file.
The default "userImplementer" is
UserBean
.
- Author:
- David Tobey
-
Method Summary
Modifier and TypeMethodDescriptionRetrieves theAdministrator
object associated with thisUser
.Retrieves theCustomer
object associated with thisUser
.Returns aMap
of any custom objects saved for thisUser
.Retrieves aCollection
ofString
s representing coupon codes entered by thisUser
.Retrieves theLocale
in effect for thisUser
.getOrder()
Retrieves theOrder
thisUser
is currently placing.void
setAdministrator
(Administrator administrator) Sets theAdministrator
object associated with thisUser
.void
setCustomer
(Customer customer) Sets theCustomer
object associated with thisUser
.void
setCustomMap
(Map data) Sets theMap
of custom objects for thisUser
.void
setEnteredCouponCodes
(Collection enteredCouponCodes) Sets theCollection
of coupon codes entered by thisUser
.void
Sets theLocale
in effect for thisUser
.void
Sets theOrder
thisUser
is currently placing.Methods inherited from interface com.softslate.commerce.businessobjects.core.BusinessObject
initialize
-
Method Details
-
getLocale
Locale getLocale()Retrieves theLocale
in effect for thisUser
. Useful to assist with the formatting of currencies and other localizations.- Returns:
- The
Locale
in effect for thisUser
.
-
setLocale
Sets theLocale
in effect for thisUser
. ThisLocale
is set in the Struts layer directly after aUser
object is created in each user's session. -
getOrder
Order getOrder()Retrieves theOrder
thisUser
is currently placing. ThisOrder
object is created when the user adds the first item to his or her cart. It is destroyed either when the user completes the order, or when his or her session ends.- Returns:
- The
Order
thisUser
is currently placing.
-
setOrder
Sets theOrder
thisUser
is currently placing. ThisOrder
object is created when the user adds the first item to his or her cart. It is destroyed either when the user completes the order, or when his or her session ends.- Parameters:
order
- TheOrder
thisUser
is currently placing.
-
getCustomer
Customer getCustomer()Retrieves theCustomer
object associated with thisUser
. When a user logs in as a customer, thisCustomer
object is created to store his or her account settings and other information.- Returns:
- The
Customer
object associated with thisUser
, ornull
, if the user has not logged in.
-
setCustomer
Sets theCustomer
object associated with thisUser
. When a user logs in as a customer, thisCustomer
object is created to store his or her account settings and other information.- Parameters:
customer
- TheCustomer
object associated with thisUser
.
-
getEnteredCouponCodes
Collection getEnteredCouponCodes()Retrieves aCollection
ofString
s representing coupon codes entered by thisUser
. When a user enters a coupon code at any point in the session, the code gets stored here for retrieval during discount processing.- Returns:
- A
Collection
ofString
s representing coupon codes entered by thisUser
.
-
setEnteredCouponCodes
Sets theCollection
of coupon codes entered by thisUser
. When a user enters a valid coupon code, the code gets stored here for later retrieval during discount processing.- Parameters:
enteredCouponCodes
- ACollection
ofString
s representing coupon codes entered by thisUser
.
-
getAdministrator
Administrator getAdministrator()Retrieves theAdministrator
object associated with thisUser
. When a user logs in as an administrator, thisAdministrator
object is created to store his or her account settings and other information.- Returns:
- The
Administrator
object associated with thisUser
, ornull
, if the user has not logged in.
-
setAdministrator
Sets theAdministrator
object associated with thisUser
. When a user logs in as an administrator, thisAdministrator
object is created to store his or her account settings and other information.- Parameters:
administrator
- TheAdministrator
object associated with thisUser
.
-
getCustomMap
Map getCustomMap()Returns aMap
of any custom objects saved for thisUser
. Custom developers may place objects in the map which need to be stored with the user throughout his session.- Returns:
- A
Map
of custom objects saved for thisUser
.
-
setCustomMap
Sets theMap
of custom objects for thisUser
. Custom developers may place objects in the map which need to be stored with the user throughout his session.- Parameters:
data
- AMap
of custom objects saved for thisUser
-