public class UserCatalogExportHandler extends DBUHandler
Modifier and Type | Field and Description |
---|---|
protected java.util.ArrayList<java.lang.String> |
ivErrors
A collection of accumulated error messages.
|
private static long |
serialVersionUID
The class' serialization version id.
|
ivContext
Constructor and Description |
---|
UserCatalogExportHandler()
Constructs a new instance of the user catalog export handler with a
null servlet or thread context. |
Modifier and Type | Method and Description |
---|---|
protected int |
exportCategoryProducts(java.io.PrintWriter out,
Category category)
Performs category export by iterating though all products this category
contains.
|
protected void |
exportProductData(java.io.PrintWriter out,
Product product,
Category category)
Writes export product line data in CIF format.
|
java.util.ArrayList<java.lang.String> |
getErrors()
Returns the collection of accumulated error messages.
|
protected java.lang.String |
getSmallDescription(Product product)
Retrieves a product's small description file as a string.
|
boolean |
run(User user,
java.io.File file)
Performs the user catalog export processing
|
protected void |
writeHeader(java.io.PrintWriter out)
Writes export file header required by CIF standard.
|
protected void |
writeTrailer(java.io.PrintWriter out,
int lineItems)
Writes export file trailer required by CIF standard.
|
getContext, setContext
private static final long serialVersionUID
protected java.util.ArrayList<java.lang.String> ivErrors
public UserCatalogExportHandler()
null
servlet or thread context.
A CONTEXT MUST BE SET BEFORE INVOKING ANY OTHER METHODS.
.public java.util.ArrayList<java.lang.String> getErrors()
public boolean run(User user, java.io.File file)
user
- (User) The user whose catalog is to be exported.file
- (File) The file where the export results are to be written.true
if the export successfully completes,
otherwise false
.protected int exportCategoryProducts(java.io.PrintWriter out, Category category) throws java.lang.Exception
out
- (PrintWriter) The output stream for the export file.category
- (Category) The category being exported.java.lang.Exception
- - if an error occurs during processing.protected void exportProductData(java.io.PrintWriter out, Product product, Category category) throws java.lang.Exception
out
- (PrintWriter) The output stream for the export file.product
- (Product) The product being exported.category
- (Category) The category being exported.java.lang.Exception
- - if an error occurs during processing.protected java.lang.String getSmallDescription(Product product) throws java.lang.Exception
product
- (Product) The product for the desired description.null
if the
product does not have a small description.java.lang.Exception
- - if an error occurs during processing.protected void writeHeader(java.io.PrintWriter out) throws java.lang.Exception
out
- (PrintWriter) The output stream for the export file.java.lang.Exception
- - if an error occurs during processing.protected void writeTrailer(java.io.PrintWriter out, int lineItems) throws java.lang.Exception
out
- (PrintWriter) The output stream for the export file.lineItems
- (int) The number of line items written to the file.java.lang.Exception
- - if an error occurs during processing.