public class ProductLookupHandler extends DBUHandler
Modifier and Type | Class and Description |
---|---|
class |
ProductLookupHandler.ERPItem
Inner class that defines the fields and methods for an ERP item object.
|
Modifier and Type | Field and Description |
---|---|
protected JDBCConnectionInfo |
ivERPConn
The current JDBC connection to the backend ERP system.
|
private static long |
serialVersionUID
The class' serialization version id.
|
protected static boolean |
UPCA_PREFIX
The configured flag for including UPCA prefix.
|
protected static boolean |
UPCA_SUFFIX
The configured flag for including UPCA suffix.
|
protected static boolean |
UPCE_EXPAND
The configured flag for including UPCE prefix.
|
protected static boolean |
UPCE_PREFIX
The configured flag for including UPCE prefix.
|
protected static boolean |
UPCE_SUFFIX
The configured flag for including UPCE suffix.
|
ivContext
Constructor and Description |
---|
ProductLookupHandler()
Constructs a new instance of the product lookup handler with a
null
servlet or thread context. |
Modifier and Type | Method and Description |
---|---|
Product |
findProduct(java.lang.String code,
java.lang.String format)
Finds the product for a given code and format.
|
protected Product |
findProduct(java.lang.String code,
java.lang.String format,
int start)
Finds the product for a given code and format.
|
protected Product |
findProductInERP(java.lang.String code)
Finds the product for a given code in the backend ERP database.
|
protected Product |
findProductInFlash(java.lang.String code)
Finds the product for a given code in the frontend Flash database.
|
protected java.lang.String |
getModifiedCode(java.lang.String code,
java.lang.String format,
int iteration)
Returns the given code's modified code based on the given format, where
the modified code might be an expansion of the given code and/or one that
has had its prefix and/or suffix information removed (based on configured
parameters).
|
protected java.lang.String |
getModifiedUPCA(java.lang.String code,
int iteration)
Returns the given code's modified UPCA code.
|
protected java.lang.String |
getModifiedUPCE(java.lang.String code,
int iteration)
Returns the given code's modified UPCE code.
|
protected boolean |
isFormatManual(java.lang.String format)
Answers if the given format is for manual entry.
|
protected boolean |
isFormatUPCA(java.lang.String format)
Answers if the given format is for a UPCA barcode.
|
protected boolean |
isFormatUPCE(java.lang.String format)
Answers if the given format is for a UPCE barcode.
|
protected boolean |
isPossibleUPCA(java.lang.String code,
java.lang.String format)
Answers if the given code and format represents a possible UPCA barcode.
|
protected boolean |
isPossibleUPCE(java.lang.String code,
java.lang.String format)
Answers if the given code and format represent a possible UPCE barcode.
|
getContext, setContext
private static final long serialVersionUID
protected static final boolean UPCA_PREFIX
protected static final boolean UPCA_SUFFIX
protected static final boolean UPCE_EXPAND
protected static final boolean UPCE_PREFIX
protected static final boolean UPCE_SUFFIX
protected JDBCConnectionInfo ivERPConn
public ProductLookupHandler()
null
servlet or thread context.
A CONTEXT MUST BE SET BEFORE INVOKING ANY OTHER METHODS.
.public Product findProduct(java.lang.String code, java.lang.String format)
code
- (String) The code to use for performing the lookup.format
- (String) The format of the lookup code (manual, UPC_A,
UPC_E, EAN_8, EAN_13, CODE_39, CODE_128, etc.).null
if no product was
found.protected Product findProduct(java.lang.String code, java.lang.String format, int start)
code
- (String) The code to use for performing the lookup.format
- (String) The format of the lookup code (manual, UPC_A,
UPC_E, EAN_8, EAN_13, CODE_39, CODE_128, etc.).start
- (int) The starting iteration to process when attempting
to find a matching product. Possible values are 1, 2 or 3.null
if no product was
found.protected Product findProductInERP(java.lang.String code)
code
- (String) The code to use for performing the lookup.null
if no product was
found.protected Product findProductInFlash(java.lang.String code)
code
- (String) The code to use for performing the lookup.null
if no product was
found.protected java.lang.String getModifiedCode(java.lang.String code, java.lang.String format, int iteration)
code
- (String) The code to modify.format
- (String) The format of the code to modify (manual, UPC_A,
UPC_E, EAN_8, EAN_13, CODE_39, CODE_128, etc.).iteration
- (int) The current lookup iteration being made to find
a matching product. Possible values are 1, 2 or 3. The first
iteration will always return the given code as is. The second
and third iterations will return a modified code depending on
the given format and any corresponding configuration values for
the format.protected java.lang.String getModifiedUPCA(java.lang.String code, int iteration)
code
- (String) The code to modify.iteration
- (int) The current lookup iteration being made to find
a matching product. Possible values are 2 or 3.protected java.lang.String getModifiedUPCE(java.lang.String code, int iteration)
code
- (String) The code to modify.iteration
- (int) The current lookup iteration being made to find
a matching product. Possible values are 2 or 3.protected boolean isFormatManual(java.lang.String format)
format
- (String) The format to check.true
if the format is manual entry,
otherwise false
.protected boolean isFormatUPCA(java.lang.String format)
format
- (String) The format to check.true
if the format is UPCA barcode,
otherwise false
.protected boolean isFormatUPCE(java.lang.String format)
format
- (String) The format to check.true
if the format is UPCE barcode,
otherwise false
.protected boolean isPossibleUPCA(java.lang.String code, java.lang.String format)
code
- (String) The code to check.format
- (String) The format to check.true
if the code and format potentially
represent a UPCA barcode, otherwise false
.protected boolean isPossibleUPCE(java.lang.String code, java.lang.String format)
code
- (String) The code to check.format
- (String) The format to check.true
if the code and format potentially
represent a UPCE barcode, otherwise false
.