public class OrderToExcel extends MainServlet
Modifier and Type | Class and Description |
---|---|
protected class |
OrderToExcel.Context
Inner class used to store servlet context information.
|
FlashServlet.Stack
Modifier and Type | Field and Description |
---|---|
private static long |
serialVersionUID
The class' serialization version id.
|
DISPLAY_MODE, SN_ADMINMODE, SN_CATEGORIES, SN_CATEGORIES_LISTONLY, SN_CATEGORIES_PATH, SN_CATEGORY, SN_CONTINUE_PAGEURL, SN_PRODUCTS, SN_PRODUCTS_INSTOCK, SN_PRODUCTS_NOSTOCK, SN_PRODUCTS_PAFILTERS, SN_PRODUCTS_PAGEHIST, SN_PRODUCTS_PAGENUM, SN_PRODUCTS_PAGEURL, SOURCE_CATALOG, SOURCE_FAVORITES, SOURCE_SEARCH, SOURCE_SHOPCART, SOURCE_SPECIAL
SN_CART, SN_LOGON_STATUS, SN_SECPROFILE, SN_USER, SN_USERSFI
BROWSER_IE, BROWSER_NN, BROWSER_XX, RESP_NULL, RESP_REDIRECTED, RQST_AJAX, RQST_NULL
Constructor and Description |
---|
OrderToExcel() |
Modifier and Type | Method and Description |
---|---|
private java.util.Date |
convertDate(java.lang.String date)
Returns a date object for a date string.
|
private java.lang.String |
convertItemName(java.lang.String name)
Returns a revised copy of an item's description.
|
private double |
convertNumber(java.lang.String number)
Returns a double for a number string.
|
protected MainServlet.Context |
createContext(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Creates the servlet context inner class.
|
private void |
createNewSheet(OrderToExcel.Context ctx)
Creates a new sheet within the current spreadsheet and sets the new
sheet's column headers.
|
protected boolean |
doMultipleOrders(OrderToExcel.Context ctx,
java.util.ArrayList<Order> orders)
Handles Excel spreadsheet creation for multiple orders.
|
protected boolean |
doSingleOrder(OrderToExcel.Context ctx,
Order order)
Handles Excel spreadsheet creation for a single order.
|
private boolean |
doSingleOrderDetail(OrderToExcel.Context ctx,
Order order,
java.util.ArrayList<OrderDetail> lineitems)
Handles Excel spreadsheet creation for a single order's detail.
|
private boolean |
doSingleOrderHeader(OrderToExcel.Context ctx,
Order order)
Handles Excel spreadsheet creation for a single order's header.
|
protected boolean |
editFormFields(BaseServlet.Context baseCtx)
Edits the values from the html template's form fields.
|
private java.lang.String |
getCustomerName(OrderToExcel.Context ctx,
java.lang.String custid)
Retrieves and returns a customer's name.
|
protected java.lang.String |
getNextURL(BaseServlet.Context baseCtx)
Returns the next URL (including parameters) to be processed when this
servlet's processing has been successfully completed (no edit errors, etc.).
|
protected java.lang.String |
getTemplateName(BaseServlet.Context baseCtx)
Returns the name of the html template file used by the servlet.
|
protected void |
readParameters(BaseServlet.Context baseCtx,
boolean post)
Reads the parameters passed to the servlet via the http request object.
|
protected boolean |
requiresLogon(BaseServlet.Context baseCtx)
Answers if the servlet requires a valid non-default user to log on in
order to continue processing.
|
protected void |
resetFormFields(BaseServlet.Context baseCtx)
Resets the values for the html template's form fields.
|
private void |
setColumnValue(OrderToExcel.Context ctx,
int colidx,
java.util.Date value)
Sets a spreadsheet column's value to a date.
|
private void |
setColumnValue(OrderToExcel.Context ctx,
int colidx,
double value)
Sets a spreadsheet column's value to a double.
|
private void |
setColumnValue(OrderToExcel.Context ctx,
int colidx,
java.lang.String value)
Sets a spreadsheet column's value to a string.
|
protected void |
setCookieValues(BaseServlet.Context baseCtx)
Adds one or more values to the http session cookies.
|
protected void |
setSessionValues(BaseServlet.Context baseCtx)
Adds one or more values to the http session object.
|
protected void |
setTemplateData(BaseServlet.Context baseCtx)
Sets the various data required by the html template.
|
protected boolean |
setTemplateError(OrderToExcel.Context ctx,
java.lang.String errName)
Sets the html template error fields for the given error name.
|
private void |
setTemplateSelections(OrderToExcel.Context ctx)
Sets the html template selected column field names.
|
confirmSession, getPreviousCategoryList, getPreviousCategoryPath, hasSubcategories, hasSubcategories, isOmitNoStock, isPreshopRequest, isUserHelpRequest, setTemplateCategoryPath, sortCategoryProductData, writePageImpl
confirmCart, confirmRequest, confirmRetail, confirmWholesale, createNewCart, createNewSessionImpl, getPageTitle, getServletPath, getUser, initTemplateDataImpl, isLogonRequest, requestComplete, resetCart, resetCategories, resetProducts, setDefaultUser, setSessionCart, setSFIShoppingUser, useExistingSessionImpl, writeCookie
createNewSession, determineBrowser, doGet, doPost, getCookie, getInvokerName, getInvokerName, getInvokerParams, getInvokerParams, getInvokerPath, getInvokerPath, getInvokerURL, getPageParams, getRequestURL, getServletName, getServletName, getServletParams, getServletParams, getServletPath, getServletURL, getServletURL, getTemplateMessage, getTemplateMessage, getTemplateMessage, getTemplateMessage, getTemplateMessage, initTemplateData, isPrintable, isServerTomcat, log, qualifyURL, redirectURL, setP3PCompactPolicy, showSiteError, showSiteError, showSiteError, useExistingSession, writeCookie, writeTempCookie
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service, service
private static final long serialVersionUID
protected boolean requiresLogon(BaseServlet.Context baseCtx)
false
for public
shopping functions and true
for admin, SAT and SFI/CSR functions.
This method should be overridden by a subclass if the subclass requires
something different than the default.
Overrides requiresLogon
in FlashServlet
.requiresLogon
in class FlashServlet
baseCtx
- (Context) The current servlet context.true
if the servlet requires a non-default
user to log on, otherwise false
.protected boolean editFormFields(BaseServlet.Context baseCtx)
doPost
method.
Overrides editFormFields
in BaseServlet
.editFormFields
in class BaseServlet
baseCtx
- (Context) The current servlet context.true
if all the edits are successful,
otherwise false
.protected java.lang.String getNextURL(BaseServlet.Context baseCtx)
writeURL
method.
Overrides getNextURL
in BaseServlet
.getNextURL
in class BaseServlet
baseCtx
- (Context) The current servlet context.protected java.lang.String getTemplateName(BaseServlet.Context baseCtx)
writePage
method.
Overrides getTemplateName
in BaseServlet
.getTemplateName
in class BaseServlet
baseCtx
- (Context) The current servlet context.protected void readParameters(BaseServlet.Context baseCtx, boolean post)
doGet
and doPost
method.
Overrides readParameters
in BaseServlet
.readParameters
in class BaseServlet
baseCtx
- (Context) The current servlet context.post
- (boolean) true
if the method is invoked from
doPost
, otherwise false
.protected void resetFormFields(BaseServlet.Context baseCtx)
doGet
and doPost
methods.
Overrides resetFormFields
in BaseServlet
.resetFormFields
in class BaseServlet
baseCtx
- (Context) The current servlet context.protected void setCookieValues(BaseServlet.Context baseCtx) throws java.io.IOException
writeURL
method. Calls should be made to writeCookie
for each cookie that needs to be set.
Overrides setCookieValues
in BaseServlet
.setCookieValues
in class BaseServlet
baseCtx
- (Context) The current servlet context.java.io.IOException
- - if an error occurs when adding the
cookie to the response header.protected void setSessionValues(BaseServlet.Context baseCtx)
writeURL
method.
Overrides setSessionValues
in BaseServlet
.setSessionValues
in class BaseServlet
baseCtx
- (Context) The current servlet context.protected void setTemplateData(BaseServlet.Context baseCtx)
writePage
method.
Overrides setTemplateData
in BaseServlet
.setTemplateData
in class BaseServlet
baseCtx
- (Context) The current servlet context.protected boolean setTemplateError(OrderToExcel.Context ctx, java.lang.String errName)
ctx
- (Context) The current servlet context..errName
- (String) The name of error that is to be set, used
to determine which message (or messages) to retrieve from the
message properties.false
.private void setTemplateSelections(OrderToExcel.Context ctx)
ctx
- (Context) The current servlet context..protected boolean doSingleOrder(OrderToExcel.Context ctx, Order order) throws java.lang.Exception
ctx
- (Context) The current servlet context..order
- (Order) The order to process.true
if processing is successful,
otherwise false
.java.lang.Exception
- - if an error occurs during processing.private boolean doSingleOrderDetail(OrderToExcel.Context ctx, Order order, java.util.ArrayList<OrderDetail> lineitems) throws java.lang.Exception
ctx
- (Context) The current servlet context..order
- (Order) The order to process.lineitems
- (ArrayList) The line items to process.true
if processing is successful,
otherwise false
.java.lang.Exception
- - if an error occurs during processing.private boolean doSingleOrderHeader(OrderToExcel.Context ctx, Order order) throws java.lang.Exception
ctx
- (Context) The current servlet context..order
- (Order) The order to process.true
if processing is successful,
otherwise false
.java.lang.Exception
- - if an error occurs during processing.protected boolean doMultipleOrders(OrderToExcel.Context ctx, java.util.ArrayList<Order> orders) throws java.lang.Exception
ctx
- (Context) The current servlet context..orders
- (ArrayList) The orders to process.true
if processing is successful,
otherwise false
.java.lang.Exception
- - if an error occurs during processing.private java.util.Date convertDate(java.lang.String date)
date
- (String) The date to convert. The date is assumed to
contain slashes with a month, day and year format and either
a 2 digit year or a 4 digit year.private java.lang.String convertItemName(java.lang.String name)
name
- (String) The item description to convert.private double convertNumber(java.lang.String number)
number
- (String) The number to convert.private void createNewSheet(OrderToExcel.Context ctx) throws java.lang.Exception
ctx
- (Context) The current servlet context..java.lang.Exception
- - if an error occurs during processing.private java.lang.String getCustomerName(OrderToExcel.Context ctx, java.lang.String custid)
ctx
- (Context) The current servlet context..custid
- (String) The id of the customer to retrieve.private void setColumnValue(OrderToExcel.Context ctx, int colidx, java.util.Date value) throws java.lang.Exception
ctx
- (Context) The current servlet context..colidx
- (int) The index of the column to set (zero based).value
- (java.util.Date) The value to set.java.lang.Exception
- - if an error occurs during processing.private void setColumnValue(OrderToExcel.Context ctx, int colidx, double value) throws java.lang.Exception
ctx
- (Context) The current servlet context..colidx
- (int) The index of the column to set (zero based).value
- (double) The value to set.java.lang.Exception
- - if an error occurs during processing.private void setColumnValue(OrderToExcel.Context ctx, int colidx, java.lang.String value) throws java.lang.Exception
ctx
- (Context) The current servlet context..colidx
- (int) The index of the column to set (zero based).value
- (String) The value to set.java.lang.Exception
- - if an error occurs during processing.protected MainServlet.Context createContext(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
createContext
in MainServlet
.
Invoked by doPost
and doGet
methods.createContext
in class MainServlet
request
- (HttpServletRequest) The servlet's incoming request.response
- (HttpServletResponse) The servlet's outgoing response.