public class CustomerImport extends Import<Customer>
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<Country> |
ivCountries
A cache of all countries.
|
private Country |
ivCountry
A country object.
|
private boolean |
ivNameMandatory
A flag indicating if name is required for add.
|
private State |
ivState
A state object.
|
private java.util.ArrayList<State> |
ivStates
A cache of all states.
|
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 |
|---|
CustomerImport()
Constructs a new customer import class.
|
| Modifier and Type | Method and Description |
|---|---|
protected boolean |
addRecord()
Adds a new record to the Flash database.
|
private boolean |
customerAssigned(java.lang.String id,
java.util.ArrayList<Customer> customers)
Answers if a customer id is assigned to other customers.
|
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 |
validCountry(java.lang.String code)
Answers if a country exists in the Flash database.
|
private boolean |
validCustomer(java.lang.String id)
Answers if a customer 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 |
validState(java.lang.String code,
java.lang.String country)
Answers if a state exists in the Flash database.
|
getContext, getMixedCase, getNumFields, getProperty, getTrueAction, isDecimal, isInteger, isStarAll, isTrue, log, log, qualifyKey, qualifyMsgId, setContext, setTextLineprivate static final long serialVersionUID
private boolean ivNameMandatory
private State ivState
private java.util.ArrayList<State> ivStates
private Country ivCountry
private java.util.ArrayList<Country> ivCountries
public void housekeeping()
housekeeping in Import.housekeeping in class Import<Customer>public boolean importData(int action,
java.util.ArrayList<java.lang.String> data,
int lineNo)
importData in Import.importData in class Import<Customer>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<Customer>true if the delete was successful,
otherwise false.protected boolean updateRecord()
updateRecord in Import.updateRecord in class Import<Customer>true if the update was successful,
otherwise false.protected boolean validForAdd()
validForAdd in Import.validForAdd in class Import<Customer>true if appropriate data has been supplied,
otherwise false.protected boolean validForDelete()
validForDelete in Import.validForDelete in class Import<Customer>true if appropriate data has been supplied,
otherwise false.protected boolean validForUpdate()
validForUpdate in Import.validForUpdate in class Import<Customer>true if appropriate data has been supplied,
otherwise false.private boolean validCountry(java.lang.String code)
code - (String) The code for the country to check.true if the country exists in the database,
otherwise false.private boolean validCustomer(java.lang.String id)
id - (String) The id for the customer to check.true if the customer exists in the database,
otherwise false.private boolean validState(java.lang.String code,
java.lang.String country)
code - (String) The state code for the state to check.country - (String) The country code for the state to check.true if the state exists in the database,
otherwise false.private boolean customerAssigned(java.lang.String id,
java.util.ArrayList<Customer> customers)
id - (String) The id of the customer to check.customers - (ArrayList) A collection of customers.true if the customer id is assigned to other
customers, otherwise false.