public class SyncProductsTask extends DBUTask
Modifier and Type | Class and Description |
---|---|
static class |
SyncProductsTask.SyncLogWriter
An inner class for persisting events to a log file and for sending alert
email messages when a configured severity level occurs.
|
Modifier and Type | Field and Description |
---|---|
private static java.lang.Thread |
cvThread
The thread running the product synchronization task.
|
private int |
ivErrRecords
The number of records where an error or warning occurred.
|
private int |
ivPriceChanged
The number of records where retail price was changed.
|
private IProductInformation |
ivProductInfo
A reference to the Product Information Interface object.
|
private int |
ivQty2Changed
The number of records where available qty2 was changed.
|
private int |
ivQtyChanged
The number of records where available qty was changed.
|
private static long |
serialVersionUID
The class' serialization version id.
|
Constructor and Description |
---|
SyncProductsTask()
Constructs a new instance of the product synchronization task with a
null servlet or thread context. |
Modifier and Type | Method and Description |
---|---|
static boolean |
isRunning()
Answers if the task is currently running.
|
java.lang.Object[] |
resultSetToObjectArray(java.sql.ResultSet rs)
Returns an object array of values from the given result set of database
records.
|
void |
run()
Runs the product synchronization task.
|
protected boolean |
synchronize(java.util.ArrayList<java.lang.Object[]> productList)
Updates a collection of Flash products with information from the backend
ERP system.
|
boolean |
valuesChanged(java.lang.Object[] values)
Answers if the given product values array containes any changed fields by
comparing "old" values (index 6, 7, 8) with "new" values (index 2, 3, 4).
|
getContext, setContext
private static final long serialVersionUID
private static java.lang.Thread cvThread
private IProductInformation ivProductInfo
private int ivQtyChanged
private int ivQty2Changed
private int ivPriceChanged
private int ivErrRecords
public SyncProductsTask()
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 java.lang.Object[] resultSetToObjectArray(java.sql.ResultSet rs) throws java.sql.SQLException
rs
- (ResultSet) The result set containing the database record
from which the values are to be obtained.java.sql.SQLException
- - if an error occurs while processing
the result set.protected boolean synchronize(java.util.ArrayList<java.lang.Object[]> productList) throws java.lang.Exception
productList
- (ArrayList) The Flash products to update.true
if the updates are successful,
otherwise false
.java.lang.Exception
- - if an error occurs while performing the
updates.public boolean valuesChanged(java.lang.Object[] values)
values
- (Object[]) The product values array to check.true
if changed values were found,
otherwise false
.