public class UserCatalog
extends java.lang.Object
implements java.io.Serializable
UserCatalogVerifier. Maintains cached maps
of products and the catalog category codes that each product is assigned to.
THIS CLASS SHOULD ONLY BE REFERENCED BY UserCatalogVerifier.
When permit processing is active, a separate instance of this class is created for each site user.
When permit processing is not active, a single instance of this class is created and used for all site users.
The primary map is keyed by product code and unit of measure code. A secondary map of products is also maintained that is keyed by product code only (no unit of measure).
| Modifier and Type | Class and Description |
|---|---|
private class |
UserCatalog.MapKey
An inner class that defines the key for a catalog mapping.
|
| Modifier and Type | Field and Description |
|---|---|
private static UserCatalog |
cvInstance
The shared instance of this class.
|
private static java.util.HashMap<java.lang.String,java.lang.String[]> |
cvTopMostCategories
A map of arrays of category codes for each category used as a topmost
category for a user.
|
private java.util.HashMap<UserCatalog.MapKey,java.util.ArrayList<java.lang.String>> |
ivCatalog1
A map of products and the categories each product is assigned to.
|
private java.util.HashMap<UserCatalog.MapKey,java.util.ArrayList<java.lang.String>> |
ivCatalog2
A map of products and the categories each product is assigned to.
|
private java.lang.String |
ivPermitId
The customer id or user id associated with the catalog.
|
private static long |
serialVersionUID
The class' serialization version id.
|
| Modifier | Constructor and Description |
|---|---|
private |
UserCatalog()
Creates a new user catalog.
|
|
UserCatalog(java.lang.String permitid)
Creates a new user catalog.
|
| Modifier and Type | Method and Description |
|---|---|
private java.lang.String[] |
buildCategoriesForTopMost(JDBCConnectionInfo cninf,
Category topmost)
Returns an array of the category codes starting with the given topmost
category.
|
java.util.ArrayList<java.lang.String> |
getCategories(JDBCConnectionInfo cninf,
java.lang.String prodcode)
Returns a product's set of assigned catalog category codes.
|
java.util.ArrayList<java.lang.String> |
getCategories(JDBCConnectionInfo cninf,
java.lang.String prodcode,
java.lang.String uomcode)
Returns a product's set of assigned catalog category codes.
|
java.lang.String[] |
getCategoriesForTopMost(JDBCConnectionInfo cninf,
Category topmost)
Returns a cached array of the category codes starting with the given topmost
category.
|
java.util.HashMap<java.lang.String,java.util.HashSet<java.lang.String>> |
getTopMostByCategoryMap(JDBCConnectionInfo cninf)
Create a map of categories and their associated topmost categories by
iterating through the topmost category cache and essentially reversing
it so we have a map keyed by the child category.
|
void |
init(JDBCConnectionInfo cninf)
Initialize the various caches associated with this instance of the object.
|
static UserCatalog |
instance()
Returns the shared instance of this class.
|
private void |
loadCatalog1(JDBCConnectionInfo cninf)
Loads the primary map of products and their assigned catalog category
codes.
|
private void |
loadCatalog2(JDBCConnectionInfo cninf)
Loads the secondary map of products and their assigned catalog category
codes.
|
private static final long serialVersionUID
private static UserCatalog cvInstance
private static java.util.HashMap<java.lang.String,java.lang.String[]> cvTopMostCategories
private java.util.HashMap<UserCatalog.MapKey,java.util.ArrayList<java.lang.String>> ivCatalog1
private java.util.HashMap<UserCatalog.MapKey,java.util.ArrayList<java.lang.String>> ivCatalog2
private java.lang.String ivPermitId
private UserCatalog()
public UserCatalog(java.lang.String permitid)
permitid - (String) The id of the customer or user associated
with the catalog.public static final UserCatalog instance()
public void init(JDBCConnectionInfo cninf)
cninf - (JDBCConnectionInfo) A database connection info object.private java.lang.String[] buildCategoriesForTopMost(JDBCConnectionInfo cninf, Category topmost)
cninf - (JDBCConnectionInfo) A database connection info object.public java.lang.String[] getCategoriesForTopMost(JDBCConnectionInfo cninf, Category topmost)
cninf - (JDBCConnectionInfo) A database connection info object.public java.util.HashMap<java.lang.String,java.util.HashSet<java.lang.String>> getTopMostByCategoryMap(JDBCConnectionInfo cninf)
cninf - (JDBCConnectionInfo) A database connection info object.public java.util.ArrayList<java.lang.String> getCategories(JDBCConnectionInfo cninf, java.lang.String prodcode)
cninf - (JDBCConnectionInfo) A database connection info object.prodcode - (String) The product code to retrieve.null if the product is not assigned to any catalog
categories.public java.util.ArrayList<java.lang.String> getCategories(JDBCConnectionInfo cninf, java.lang.String prodcode, java.lang.String uomcode)
cninf - (JDBCConnectionInfo) A database connection info object.prodcode - (String) The product code to retrieve.uomcode - (String) The unit of measure code to retrieve.null if the product is not assigned to any catalog
categories.private void loadCatalog1(JDBCConnectionInfo cninf)
ivCatalog1 instance variable.cninf - (JDBCConnectionInfo) A database connection info object.private void loadCatalog2(JDBCConnectionInfo cninf)
ivCatalog2 instance variable.cninf - (JDBCConnectionInfo) A database connection info object.