public class ImportProductTask extends DBUTask
Modifier and Type | Field and Description |
---|---|
private static java.lang.Thread |
cvThread
The thread running the import product task.
|
static java.lang.String |
ERRORS_SEVERE
The value of the "ImportValidation.Errors.Severe" key in properties.
|
static java.lang.String |
ERRORS_WARNING
The value of the "ImportValidation.Errors.Warning" key in properties.
|
private ImportBatch |
ivBatch
The current batch being processed.
|
private int |
ivMode
The current mode being processed.
|
static int |
MODE_IMPORT_BATCH
The mode for batch import.
|
static int |
MODE_IMPORT_DELETE
The mode for batch delete.
|
static int |
MODE_IMPORT_PENDING
The mode for pending product import.
|
static int |
MODE_PENDING_DELETE
The mode for pending product delete.
|
static int |
MODE_PENDING_POST
The mode for pending product post.
|
static int |
MODE_PENDING_VALIDATE
The mode for pending product validate.
|
private static long |
serialVersionUID
The class' serialization version id.
|
Constructor and Description |
---|
ImportProductTask()
Constructs a new instance of the import batch task with a
null
servlet or thread context. |
Modifier and Type | Method and Description |
---|---|
protected boolean |
canPost(PendingProduct pending)
Answers if a pending product record can be posted by checking for any
severe errors.
|
protected boolean |
deleteBatch()
Handles processing for import batch delete requests.
|
ImportBatch |
getBatch()
Returns the import batch being processed.
|
int |
getMode()
Returns the import mode being processed.
|
protected boolean |
importToBatch()
Handles processing for import to batch requests.
|
protected boolean |
importToPending()
Handles processing for import to pending product requests.
|
static boolean |
isRunning()
Answers if the task is currently running.
|
private boolean |
logError(java.lang.String msgkey,
java.lang.String insert)
Writes the text for the given error message key and insertion text to
the log.
|
protected boolean |
postBatch()
Handles processing for pending product batch post requests.
|
boolean |
postRecord(PendingProduct pending,
boolean batchmode)
Handles processing for pending product record post requests.
|
void |
run()
Runs the import batch task.
|
void |
setBatch(ImportBatch batch)
Sets the import batch to process.
|
void |
setMode(int mode)
Sets the import mode to process.
|
protected boolean |
validateBatch()
Handles processing for pending product batch validation requests.
|
protected boolean |
validateBatchResults()
Updates the batch with the results of the validation processing.
|
boolean |
validateRecord(PendingProduct pending,
boolean post)
Handles processing for pending product record validation requests.
|
getContext, setContext
private static final long serialVersionUID
private static java.lang.Thread cvThread
public static final int MODE_IMPORT_BATCH
public static final int MODE_IMPORT_PENDING
public static final int MODE_IMPORT_DELETE
public static final int MODE_PENDING_VALIDATE
public static final int MODE_PENDING_POST
public static final int MODE_PENDING_DELETE
public static final java.lang.String ERRORS_WARNING
public static final java.lang.String ERRORS_SEVERE
private int ivMode
private ImportBatch ivBatch
public ImportProductTask()
null
servlet or thread context.
A CONTEXT MUST BE SET BEFORE INVOKING ANY OTHER METHODS.
.public void run()
Runnable
interface.public static boolean isRunning()
true
if the task is currently running,
otherwise false
.public int getMode()
public void setMode(int mode)
mode
- (int) The mode to process.public ImportBatch getBatch()
public void setBatch(ImportBatch batch)
batch
- (ImportBatch) The batch to process.protected boolean deleteBatch() throws java.lang.Exception
true
if the processing successfully completes,
otherwise false
.java.lang.Exception
- - if an error occurrs during processing.protected boolean importToBatch() throws java.lang.Exception
true
if the processing successfully completes,
otherwise false
.java.lang.Exception
- - if an error occurrs during processing.protected boolean importToPending() throws java.lang.Exception
true
if the processing successfully completes,
otherwise false
.java.lang.Exception
- - if an error occurrs during processing.protected boolean validateBatch() throws java.lang.Exception
true
if the processing successfully completes,
otherwise false
.java.lang.Exception
- - if an error occurrs during processing.protected boolean validateBatchResults() throws java.lang.Exception
true
if the results are successfully
updated, otherwise false
.java.lang.Exception
- - if an error occurrs during processing.public boolean validateRecord(PendingProduct pending, boolean post)
pending
- (PendingProduct) The pending product to be validated.post
- (boolean) true
if the record is to be posted
after the validation sucessfully completes, otherwise false
. Always false
when running in batch mode (batch
mode posting is run after all records have been validated).true
if the validation is successful,
otherwise false
.protected boolean postBatch() throws java.lang.Exception
true
if the processing successfully completes,
otherwise false
.java.lang.Exception
- - if an error occurrs during processing.public boolean postRecord(PendingProduct pending, boolean batchmode)
pending
- (PendingProduct) The pending product to be posted.batchmode
- (boolean) true
if the processor is running
in batch mode, otherwise false
. Controls whether the
pending product is physically deleted from the pending product
table, or simply updated with the delete status.true
if the posting is successful,
otherwise false
.protected boolean canPost(PendingProduct pending)
pending
- (PendingProduct) The pending product to be posted.true
if the pending product can be posted,
otherwise false
.private boolean logError(java.lang.String msgkey, java.lang.String insert)
msgkey
- (String) The key for the error message to be logged.insert
- (String) Additional text to be inserted into the message.false
.