|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.bigllc.retsiq.simpleclient.util.DivideAndConquerStrategy<T>
public abstract class DivideAndConquerStrategy<T>
Abstract search strategy for dividing and conquering on a particular data type. This checks a record count for a range of the field supplied. If the count falls within the record limit then the query is added to the stack. If it exceed the limit then the range is halved. When search queries have been created to allow a full listing download the queries are all executed sequentially.
| Constructor Summary | |
|---|---|
DivideAndConquerStrategy(int recordCountLimit,
java.lang.String fieldName,
T startValue,
T endValue)
Create a strategy that is based around an integer field. |
|
| Method Summary | |
|---|---|
protected abstract T |
getMidPoint(T start,
T end)
Get the mid point of the two supplied value, rounding down however that applies to the type. |
java.util.List<java.lang.String> |
getQueryBatches(RETSUserSession session,
java.lang.String path,
java.lang.String query)
Get a list of queries that break up the original query so that all records for the original query can be retrieved/ |
protected abstract java.lang.String |
getSearchValue(T value)
Return the value as a string that is valid for a DMQL2 query for that data type. |
protected abstract T |
incrementValue(T value)
Increment the value by one unit whatever that means for the type. |
void |
search(RETSUserSession session,
java.lang.String path,
java.lang.String query,
java.util.List<java.lang.String> fields,
boolean decoded,
SearchResponseHandler out)
Execute a search using the strategy implemented to return all the records using multiple queries. |
protected abstract boolean |
valuesEqual(T o1,
T o2)
Compare the two values for equality. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DivideAndConquerStrategy(int recordCountLimit,
java.lang.String fieldName,
T startValue,
T endValue)
recordCountLimit - the limit for each search, this should be less
than any limit imposed by the serverfieldName - the name of the field to be used for dividing and
conquering searches. For example the list pricestartValue - The inclusive start value of the range to query for
that type.endValue - The inclusive end value of the range to query. A further
query is executed for anything above this value to catch outliers.| Method Detail |
|---|
public void search(RETSUserSession session,
java.lang.String path,
java.lang.String query,
java.util.List<java.lang.String> fields,
boolean decoded,
SearchResponseHandler out)
throws RETSClientException
SearchStrategy
search in interface SearchStrategysession - the user session to search withpath - the resource and classification to query in the following
format - /<Resource>/<Classification>.query - the DMQL2 query to execute.fields - the fields to return, an empty list or null will
fetch all the fields.decoded - if true lookup values are decoded otherwise raw values
are returned.out - the handler to process the response.
RETSClientException
public java.util.List<java.lang.String> getQueryBatches(RETSUserSession session,
java.lang.String path,
java.lang.String query)
throws RETSClientException
SearchStrategy
getQueryBatches in interface SearchStrategysession - the user session to search withpath - the resource and classification to query in the following
format - /<Resource>/<Classification>.query - the DMQL2 query to execute.
RETSClientExceptionprotected abstract java.lang.String getSearchValue(T value)
value - the value
protected abstract T getMidPoint(T start,
T end)
start - the lower bounded valueend - the upper bounded value
protected abstract T incrementValue(T value)
value - the value to increment
protected abstract boolean valuesEqual(T o1,
T o2)
o1 - the value to compare againsto2 - the value to compare to
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||