public class ProductSearch2 extends java.lang.Object implements ProductSearchInterface
ProductSearchInterface
that searches products
using the IBM AS/400 Webserver search engine.Modifier and Type | Class and Description |
---|---|
protected class |
ProductSearch2.ProductSort
Comparator class that implements a product sort using product code and
unit of measure code.
|
Modifier and Type | Field and Description |
---|---|
protected static java.lang.String |
cvIndexDir
Index directory
|
protected static java.lang.String |
cvIndexName
Index name
|
protected static java.lang.String |
cvNumberOfMatches
Number of matches to return
|
protected static java.lang.String |
cvTargetURL
URL to the search service macro
|
protected static int |
cvTimeout
The number of seconds to wait for a response from the search service
|
private java.util.HashMap<java.lang.String,java.util.Date> |
ivTrace
Map to hold trace timing by boundry name
|
private static long |
serialVersionUID
The class' serialization version id.
|
static boolean |
TRACE
Constant which turns on detailed tracing
|
Constructor and Description |
---|
ProductSearch2()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getAbsolutePath(java.lang.String s)
Adds the site's root path if the given path is relative (relative means
path does not begin with /), otherwise the path is assumed to be absolute
already and simply returns as is.
|
java.util.ArrayList<Product> |
getMatchingProducts(FlashServletContext ctx,
java.lang.String searchString,
java.util.ArrayList<java.lang.String[]> searchAttributes)
Returns a list of products that match the given search criteria and are
in the session user's catalog.
|
java.util.ArrayList<Product> |
getMatchingProducts(FlashServletContext ctx,
java.lang.String searchString,
java.util.ArrayList<java.lang.String[]> searchAttributes,
java.lang.String catcat,
int maxhits)
Returns a list of products that match the given search criteria and are
in the given catalog category.
|
protected java.lang.String |
getUnFSValidFileName(java.lang.String name)
Returns a product ID based on a file system safe file name.
|
protected boolean |
isCodeInList(java.lang.String code,
java.util.ArrayList<Product> list)
Checks if list of products contains product with code.
|
protected java.lang.String |
processResultLine(java.lang.String line)
Extracts the product ID string from the supplied string.
|
protected java.util.ArrayList<java.lang.String> |
querySearchService(java.lang.String query)
Communicates with the AS/400 webserver search service.
|
protected void |
trace(java.lang.String x)
Detailed tracing.
|
protected void |
traceEnd(java.lang.String x)
End detailed trace boundry, outputs elapsed time since the start of this
boundry.
|
protected void |
traceStart(java.lang.String x)
Start detailed trace boundry.
|
protected java.util.ArrayList<java.lang.String> |
verifyProductCodes(UserCatalogVerifier ucv,
java.util.ArrayList<java.lang.String> prodCodes)
Verifies that each product code within the given collection of product codes
is in the session user's catalog and/or in the user's set of permits and
returns a collection that contains only the product codes that pass the
verification.
|
private static final long serialVersionUID
public static final boolean TRACE
protected static final int cvTimeout
protected static final java.lang.String cvTargetURL
protected static final java.lang.String cvIndexDir
protected static final java.lang.String cvIndexName
protected static final java.lang.String cvNumberOfMatches
private java.util.HashMap<java.lang.String,java.util.Date> ivTrace
public java.util.ArrayList<Product> getMatchingProducts(FlashServletContext ctx, java.lang.String searchString, java.util.ArrayList<java.lang.String[]> searchAttributes)
getMatchingProducts
in interface ProductSearchInterface
ctx
- (FlashServletContext) The current servlet context.searchString
- (String) The search criteria.searchAttributes
- (ArrayList) The extended attributes search
criteria, a list of String[]
where element 0 is
attribute code, and 1 is relation.public java.util.ArrayList<Product> getMatchingProducts(FlashServletContext ctx, java.lang.String searchString, java.util.ArrayList<java.lang.String[]> searchAttributes, java.lang.String catcat, int maxhits)
getMatchingProducts
in interface ProductSearchInterface
ctx
- (FlashServletContext) The current servlet context.searchString
- (String) The search criteria.searchAttributes
- (ArrayList) The extended attributes search
criteria, a list of String[]
where element 0 is
attribute code, and 1 is relation.catcat
- (String) The catalog category for the results.maxhits
- (int) The maximum number of matches. A 0 (zero)
indicates no maximum.public static java.lang.String getAbsolutePath(java.lang.String s)
s
- (String) The string to process.protected java.lang.String getUnFSValidFileName(java.lang.String name)
name
- (String) A file name (not including file path) that is to
be manipulated.protected boolean isCodeInList(java.lang.String code, java.util.ArrayList<Product> list)
code
- (String) The product code to check.list
- (ArrayList) The list products to check.true
if the code is in the list,
otherwise false
.protected java.util.ArrayList<java.lang.String> querySearchService(java.lang.String query)
query
- (String) The user's search string.protected java.lang.String processResultLine(java.lang.String line)
line
- (String) The raw result string from the search server.protected java.util.ArrayList<java.lang.String> verifyProductCodes(UserCatalogVerifier ucv, java.util.ArrayList<java.lang.String> prodCodes)
ucv
- (UserCatalogVerifier) The verifier to use for verification.prodCodes
- (ArrayList) The set of product codes that are to be
verified.protected void trace(java.lang.String x)
x
- (String) Text to add to the trace.protected void traceStart(java.lang.String x)
x
- (String) Name of the trace boundry.protected void traceEnd(java.lang.String x)
x
- (String) Name of the trace boundry.