public class ProductImport extends Import<Product>
NOTE: A single instance of this class is cached by ImportProcessor
and used throughout the import processing.
Modifier and Type | Field and Description |
---|---|
private java.util.ArrayList<Category> |
ivCategories
A cache of all categories.
|
private Category |
ivCategory
A category object.
|
private boolean |
ivDeleteDescrFiles
A flag indicating if description files should be deleted.
|
private boolean |
ivDeleteImageFiles
A flag indicating if images files should be deleted.
|
private Leadtime |
ivLeadtime
A lead time object.
|
private java.util.ArrayList<Leadtime> |
ivLeadtimes
A cache of all lead times.
|
private Manufacturer |
ivManufacturer
A manufacturer object.
|
private java.util.ArrayList<Manufacturer> |
ivManufacturers
A cache of all manufacturers.
|
private UnitMeasure |
ivUnitMeasure
A unit of measure object.
|
private java.util.ArrayList<UnitMeasure> |
ivUnitMeasures
A cache of all units of measure.
|
private boolean |
ivUpdateDescrFiles
A flag indicating if description files should be updated.
|
private static long |
serialVersionUID
The class' serialization version id.
|
ACTION_ADD, ACTION_CLEAR, ACTION_DELETE, ACTION_UPDATE, ACTION_UPDATE_ADD, ivContext, ivLineNo, ivNumFields, ivObject, ivStarAll, ivTextLine, ivUseMixedCase, ivValues
Constructor and Description |
---|
ProductImport()
Constructs a new product import class.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
addRecord()
Adds a new record to the Flash database.
|
protected boolean |
deleteRecord()
Deletes an existing record from the Flash database.
|
void |
housekeeping()
Garbage collection: Kills (nullifies) objects used by the import class.
|
boolean |
importData(int action,
java.util.ArrayList<java.lang.String> data,
int lineNo)
Imports a record of data values into the Flash database.
|
protected boolean |
updateRecord()
Updates an existing record in the Flash database.
|
private boolean |
validCategory(java.lang.String code)
Answers if a category exists in the Flash database.
|
protected boolean |
validForAdd()
Answers if appropriate data has been supplied in order to add a record
to the Flash database.
|
protected boolean |
validForDelete()
Answers if appropriate data has been supplied in order to delete a record
in the Flash database.
|
protected boolean |
validForUpdate()
Answers if appropriate data has been supplied in order to update a record
in the Flash database.
|
private boolean |
validLeadtime(java.lang.String code)
Answers if a lead time exists in the Flash database.
|
private boolean |
validManufacturer(java.lang.String code)
Answers if a manufacturer exists in the Flash database.
|
private boolean |
validUnitMeasure(java.lang.String code)
Answers if a unit of measure exists in the Flash database.
|
private void |
writeDescriptionFile(java.lang.String content,
int size)
Writes a product description file to the file system for the current
product being added or updated.
|
getContext, getMixedCase, getNumFields, getProperty, getTrueAction, isDecimal, isInteger, isStarAll, isTrue, log, log, qualifyKey, qualifyMsgId, setContext, setTextLine
private static final long serialVersionUID
private boolean ivDeleteImageFiles
private boolean ivDeleteDescrFiles
private boolean ivUpdateDescrFiles
private Category ivCategory
private java.util.ArrayList<Category> ivCategories
private Leadtime ivLeadtime
private java.util.ArrayList<Leadtime> ivLeadtimes
private Manufacturer ivManufacturer
private java.util.ArrayList<Manufacturer> ivManufacturers
private UnitMeasure ivUnitMeasure
private java.util.ArrayList<UnitMeasure> ivUnitMeasures
public void housekeeping()
housekeeping
in Import
.housekeeping
in class Import<Product>
public boolean importData(int action, java.util.ArrayList<java.lang.String> data, int lineNo)
importData
in Import
.importData
in class Import<Product>
action
- (int) The action code (i.e. add, update, delete).data
- (ArrayList) The set of data values to be imported. Each
element corresponds to a field in the original text line.lineNo
- (int) The current line number being processedtrue
if the import of data was successful,
otherwise false
.protected boolean addRecord()
addRecord
in Import
.protected boolean deleteRecord()
deleteRecord
in Import
.deleteRecord
in class Import<Product>
true
if the delete was successful,
otherwise false
.protected boolean updateRecord()
updateRecord
in Import
.updateRecord
in class Import<Product>
true
if the update was successful,
otherwise false
.protected boolean validForAdd()
validForAdd
in Import
.validForAdd
in class Import<Product>
true
if appropriate data has been supplied,
otherwise false
.protected boolean validForDelete()
validForDelete
in Import
.validForDelete
in class Import<Product>
true
if appropriate data has been supplied,
otherwise false
.protected boolean validForUpdate()
validForUpdate
in Import
.validForUpdate
in class Import<Product>
true
if appropriate data has been supplied,
otherwise false
.private boolean validCategory(java.lang.String code)
code
- (String) The code for the category to check.true
if the category exists in the database,
otherwise false
.private boolean validLeadtime(java.lang.String code)
code
- (String) The code for the lead time to check.true
if the lead time exists in the database,
otherwise false
.private boolean validManufacturer(java.lang.String code)
code
- (String) The code for the manufacturer to check.true
if the manufacturer exists in the database,
otherwise false
.private boolean validUnitMeasure(java.lang.String code)
code
- (String) The code for the unit of measure to check.true
if the unit of measure exists in the
database, otherwise false
.private void writeDescriptionFile(java.lang.String content, int size)
content
- (String) The text content of the file.size
- (int) The size of the description file (short or long)
that is to be written. Must be one of the Product.SIZE
constants.