|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.softslate.commerce.businessobjects.core.BaseBusinessObject
com.softslate.commerce.businessobjects.core.BaseBusinessProcessor
public abstract class BaseBusinessProcessor
Abstract superclass for all processing objects in the business layer. (Classes that handle business processing are all named with the suffix "Processor".)
The methods provided here allow subclasses to communicate with other elements
of the application. In particular, retrieve general settings from the
database (using getSettings()), retrive application settings from
the /WEB-INF/classes/appSettings.properties file (using
getAppSettings(), retrive application components from the
/WEB-INF/classes/appComponents.properties file (using
getAppComponents(), retrieve user information (using
getUser()), create data access objects (using
getDaoFactory()) and create other business objects (using
getBusinessObjectFactory()).
| Field Summary | |
|---|---|
private java.util.Properties |
appComponents
|
private java.util.Properties |
appSettings
|
private BusinessObjectFactory |
businessObjectFactory
|
private DAOFactory |
daoFactory
|
(package private) static org.apache.commons.logging.Log |
log
|
private Settings |
settings
|
private User |
user
|
private BusinessObjectUtils |
utils
|
| Constructor Summary | |
|---|---|
BaseBusinessProcessor()
|
|
| Method Summary | |
|---|---|
java.lang.String |
formatDateTime(java.util.Date dateTime)
Formats a Date object into a string suitable for storage in the database. |
java.lang.String |
formatPrice(double rawPrice,
java.lang.String currencyCode,
java.util.Locale locale)
Formats a double into a string suitable for displaying the double as a price. |
java.util.Properties |
getAppComponents()
Retrieves this object's application components. |
java.util.Properties |
getAppSettings()
Retrieves the application settings previously set for this object. |
java.util.Collection |
getAttributeIDs(java.util.Collection orderItems)
Constructs a Collection of Integers composed of the attributeIDs of the OrderItemAttriubtes associated with a given Collection of OrderItem objects. |
BusinessObjectFactory |
getBusinessObjectFactory()
Retrieves the BusinessObjectFactory previously set for
this business object. |
DAOFactory |
getDaoFactory()
Retrieves the DAOFactory previously set for this business
object. |
java.util.Collection |
getProductIDs(java.util.Collection orderItems)
Constructs a Collection of Integers composed of the productIDs of a given Collection of OrderItem objects. |
Settings |
getSettings()
Retrieves the Settings instance previously set for this
business object. |
User |
getUser()
Retrieves the User previously set for this business
object. |
void |
initialize(java.util.Map transferMap)
Initializes this business object by copying incoming parameters into its properties. |
java.util.Collection |
loadMatchingSkus(java.util.Collection orderItems,
java.util.Collection productIDs,
java.util.Collection attributeIDs)
Given a Collection of productIDs and OrderItem objects, construct a Collection of Maps composed of all of the SKUs that match the order items. |
java.util.Date |
parseDateTime(java.lang.String dateTime)
Parses a string into a Date object. |
java.util.Map |
parseResponseData(java.lang.String response)
Parses a query string of name value pairs into a Map. |
java.lang.String |
prepareRequestData(java.util.Map params,
boolean urlEncode)
Prepares a url-encoded string for use with an HTTP request, given a map of the request's parameters. |
java.lang.String |
sendHTTPPost(java.lang.String urlString,
java.lang.String postData,
boolean followRedirect)
Sends an HTTP request using the POST method to a given URL. |
java.lang.String |
sendHTTPPost(java.lang.String urlString,
java.lang.String postData,
boolean followRedirect,
java.util.Map requestProperties,
java.lang.String inputCharSet)
Sends an HTTP request using the POST method to a given URL. |
void |
setAppComponents(java.util.Properties appComponents)
Sets this object's application components. |
void |
setAppSettings(java.util.Properties appSettings)
Sets this object's application settings. |
void |
setBusinessObjectFactory(BusinessObjectFactory businessObjectFactory)
Sets this business object's BusinessObjectFactory. |
void |
setDaoFactory(DAOFactory daoFactory)
Sets this business object's DAOFactory. |
void |
setSettings(Settings settings)
Sets this business object's Settings instance. |
void |
setUser(User user)
Sets this business object's User. |
void |
updateOrderTotals()
|
void |
updateOrderTotals(boolean subtractGiftCerts)
Updates the totals of a user's order taking into account taxes and shipping. |
BusinessObjectUtils |
utils()
Retrieves a utility object that provides useful methods for business objects. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
static org.apache.commons.logging.Log log
private Settings settings
private java.util.Properties appSettings
private java.util.Properties appComponents
private User user
private DAOFactory daoFactory
private BusinessObjectFactory businessObjectFactory
private BusinessObjectUtils utils
| Constructor Detail |
|---|
public BaseBusinessProcessor()
| Method Detail |
|---|
public Settings getSettings()
BusinessProcessorSettings instance previously set for this
business object. The Settings object holds general
settings stored in the sscSetting database table.
getSettings in interface BusinessProcessorSettings object that represents various settings
for the system.public void setSettings(Settings settings)
BusinessProcessorSettings instance. Used by the
application's BusinessObjectFactory (through
initialize(Map parameters)), to provide the system's
Settings to this business object.
setSettings in interface BusinessProcessorsettings - The current Settings for the system, containing
various settings to be used by this business object.public java.util.Properties getAppSettings()
BusinessProcessorSettings interface, which stores settings drawn from
the database. They are stored in the
/WEB-INF/classes/appSettings.properties file under each
installation.
getAppSettings in interface BusinessProcessorProperties object that represents various
settings for the application.public void setAppSettings(java.util.Properties appSettings)
BusinessProcessorSettings
interface, which stores settings drawn from the database.
setAppSettings in interface BusinessProcessorappSettings - The current application settings in effect for the system.public java.util.Properties getAppComponents()
BusinessProcessor/WEB-INF/classes/appComponents.properties file under each
installation.
getAppComponents in interface BusinessProcessorProperties object that represents component
settings for the application.public void setAppComponents(java.util.Properties appComponents)
BusinessProcessor
setAppComponents in interface BusinessProcessorappComponents - The current application components in effect for the system.public User getUser()
BusinessProcessorUser previously set for this business
object. In the struts layer, this property corresponds to the "user"
attribute of each session.
getUser in interface BusinessProcessorUser object that represents the user currently
accessing the system.public void setUser(User user)
BusinessProcessorUser. Used by the
application's BusinessObjectFactory (through
initialize(Map parameters)), to provide the current
User accessing the system to this business object. In the
struts layer, this property corresponds to the "user" attribute of each
session.
setUser in interface BusinessProcessoruser - The current User accessing the system, for
which business processing is to be performed by this business
object.public DAOFactory getDaoFactory()
BusinessProcessorDAOFactory previously set for this business
object.
getDaoFactory in interface BusinessProcessorDAOFactory object that can be used to create
data access objects.public void setDaoFactory(DAOFactory daoFactory)
BusinessProcessorDAOFactory. Used by the
application's BusinessObjectFactory (through
initialize(Map parameters)), to provide the current
DAOFactory for the system to this business object.
setDaoFactory in interface BusinessProcessordaoFactory - The current DAOFactory for the system, which
will allow this business object to create data access objects.
public void initialize(java.util.Map transferMap)
throws java.lang.Exception
BusinessObjectBusinessObjectFactory
immediately after object creation.
initialize in interface BusinessObjectinitialize in class BaseBusinessObjecttransferMap - A Map containing objects such as the
application's DAOFactory,
Settings,User, and
BusinessObjectFactory.
java.lang.Exceptionpublic BusinessObjectFactory getBusinessObjectFactory()
BusinessProcessorBusinessObjectFactory previously set for
this business object.
getBusinessObjectFactory in interface BusinessProcessorBusinessObjectFactory object that can be used to
create other business objects.public void setBusinessObjectFactory(BusinessObjectFactory businessObjectFactory)
BusinessProcessorBusinessObjectFactory. Used
by the application's BusinessObjectFactory (through
initialize(Map parameters)), to provide itself to this
business object, so that it can create other business objects in turn.
setBusinessObjectFactory in interface BusinessProcessorbusinessObjectFactory - The current BusinessObjectFactory for the
system, allowing this business object to create other business
objects.public BusinessObjectUtils utils()
BusinessProcessor
utils in interface BusinessProcessorBusinessObjectUtils.public java.lang.String formatDateTime(java.util.Date dateTime)
dateTime -
public java.util.Date parseDateTime(java.lang.String dateTime)
dateTime - a String in the form of "yyyy-MM-dd HH:mm:ss:SSS" suitable for
storage in the database.
public java.lang.String formatPrice(double rawPrice,
java.lang.String currencyCode,
java.util.Locale locale)
rawPrice - currencyCode - locale -
public java.lang.String prepareRequestData(java.util.Map params,
boolean urlEncode)
throws java.lang.Exception
params - A Map of key-value String pairs representing the parameters of
the request.
java.lang.Exception
public java.util.Map parseResponseData(java.lang.String response)
throws java.lang.Exception
response - A String key-value pairs in the form of a URL query string
java.lang.Exception
public java.lang.String sendHTTPPost(java.lang.String urlString,
java.lang.String postData,
boolean followRedirect,
java.util.Map requestProperties,
java.lang.String inputCharSet)
throws java.lang.Exception
urlString - The URL to send the request to.postData - A String representing a valid URL-encoded query string.followRedirect - A boolean indicating whether redirects should be followed.requestProperties - Map that holds request properties to be sent in connection.inputCharSet - Character set of the response data
java.lang.Exception
public java.lang.String sendHTTPPost(java.lang.String urlString,
java.lang.String postData,
boolean followRedirect)
throws java.lang.Exception
urlString - The URL to send the request to.postData - A String representing a valid URL-encoded query string.followRedirect - A boolean indicating whether redirects should be followed.
java.lang.Exception
public java.util.Collection getProductIDs(java.util.Collection orderItems)
throws java.lang.Exception
orderItems -
java.lang.Exception
public java.util.Collection getAttributeIDs(java.util.Collection orderItems)
throws java.lang.Exception
orderItems -
java.lang.Exception
public java.util.Collection loadMatchingSkus(java.util.Collection orderItems,
java.util.Collection productIDs,
java.util.Collection attributeIDs)
throws java.lang.Exception
orderItems - productIDs -
java.lang.Exception
public void updateOrderTotals()
throws java.lang.Exception
java.lang.Exception
public void updateOrderTotals(boolean subtractGiftCerts)
throws java.lang.Exception
Order and that order's first
OrderDelivery are updated with new price totals and
subtotals.
java.lang.Exception
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||