|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.di.server.SearchCriteria
public class SearchCriteria
This class contains a list of generic search criteria and methods to generate them. The search criteria is e.g. attr equals value. The class also has a number of methods to convert the generic criteria to standard expressions like LDAP search filters, SQL select statements etc.
The class also provides a means to define templates which can be expanded using a com.ibm.di.entry.Entry object. The expanded templates can then be accessed through the criteria methods.
The typical use of this class is to:
All getXXXFilter methods first check if the class was created with a user defined script to return the search string. Thus, if you create an istance of this class with a script/ScriptEngine and use f.ex the LDAP connector, the search filter used by the LDAP connector will be the result of the script evaluation rather than the getLDAPFilter method.
Nested Class Summary | |
---|---|
class |
SearchCriteria.rscSearch
This class is used internally. |
Field Summary | |
---|---|
static int |
EXACT
|
static int |
EXCACT
|
String |
filter
|
static int |
FINAL_STRING
|
static int |
INITIAL_STRING
|
static int |
NOT_STRING
|
ParameterSubstitutionCache |
psc
|
static int |
SEARCH_AND
|
static int |
SEARCH_NOT
|
static int |
SEARCH_OR
|
static int |
SUBSTRING
|
Constructor Summary | |
---|---|
SearchCriteria()
|
|
SearchCriteria(int matchtype)
|
|
SearchCriteria(String name,
int match,
Object value)
|
|
SearchCriteria(String criteriaScript,
ScriptEngine engine)
|
Method Summary | |
---|---|
void |
addCriteria(String name,
int match,
Object value)
Add expression to criteria array. |
void |
addCriteria(String name,
int match,
Object value,
boolean negate)
Add expression to criteria array. |
void |
addTemplate(String name,
int match,
String defvalue)
Add a criteria to the templates array. |
void |
addTemplate(String name,
String match,
String defvalue)
Add a criteria to the templates array. |
void |
buildCriteria(Entry e)
Build the criteria array using provided entry. |
void |
buildCriteria(Entry e,
BaseConfiguration config,
Object task)
|
void |
buildCriteriaScript(Entry entry)
Call user defined script to build the search filter. |
String |
buildLdapFilter(SearchCriteria.rscSearch rs)
Constructs an LDAP search filter from an rscSearch class. |
String |
buildNotesFilter(SearchCriteria.rscSearch rs)
Constructs an Notes search filter from an rscSearch class. |
String |
buildNotesFTFilter(SearchCriteria.rscSearch rs)
Constructs an Notes FullText search filter from an rscSearch class. |
String |
buildSQLFilter(SearchCriteria.rscSearch rs)
Constructs an SQL where expression from an rscSearch class. |
Vector |
getCriteria()
|
SearchCriteria.rscSearch |
getCriteria(int index)
Return criteria class at specified index. |
Entry |
getCurrentEntry()
Return the working entry used to generate the criteria array from the templates array. |
int |
getFirstCriteriaMatch()
Return match operator of first criteria entry. |
String |
getFirstCriteriaName()
Return name of first criteria entry. |
String |
getFirstCriteriaValue()
Return value of first criteria entry. |
String |
getLDAPFilter()
Return complete LDAP filter from criteria array. |
String |
getNotesFilter()
Return complete Notes search expression from criteria array. |
String |
getNotesFTFilter()
Return complete Notes FullText search expression from criteria array. |
String |
getScriptFilter()
This method executes a script that returns a user-defined search filter. |
String |
getSearchString(int i)
|
String |
getSimpleFilter()
|
String |
getSQLFilter()
Return complete SQL search expression from criteria array. |
SearchCriteria.rscSearch |
getTemplate(int index)
Returns the criteria template at a specific location. |
int |
getType()
Return search type. |
boolean |
isConfigured()
|
void |
replaceCriteria(String name,
Object value)
Add expression to criteria array, replacing all previous occurences with the same attribute name. |
void |
setType(int type)
Set type (SEARCH_AND, SEARCH_OR) for the search criteria. |
int |
size()
Return number of templates. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int EXACT
public static final int EXCACT
public static final int SUBSTRING
public static final int INITIAL_STRING
public static final int FINAL_STRING
public static final int NOT_STRING
public static final int SEARCH_AND
public static final int SEARCH_OR
public static final int SEARCH_NOT
public String filter
public ParameterSubstitutionCache psc
Constructor Detail |
---|
public SearchCriteria()
public SearchCriteria(int matchtype)
public SearchCriteria(String name, int match, Object value)
public SearchCriteria(String criteriaScript, ScriptEngine engine)
Method Detail |
---|
public int size()
public SearchCriteria.rscSearch getCriteria(int index)
public Vector getCriteria()
public void addCriteria(String name, int match, Object value)
name
- The attribute namematch
- The match operator (e.g. EXACT, FINAL_STRING ..)value
- The matching value.public void addCriteria(String name, int match, Object value, boolean negate)
name
- The attribute namematch
- The match operator (e.g. EXACT, FINAL_STRING ..)value
- The matching value.negate
- Specify true to negate the expressionpublic void replaceCriteria(String name, Object value)
name
- The attribute namevalue
- The matching value.public String getFirstCriteriaName()
public String getFirstCriteriaValue()
public int getFirstCriteriaMatch()
public void setType(int type)
type
- SEARCH_AND, SEARCH_ORpublic int getType()
public SearchCriteria.rscSearch getTemplate(int index)
index
- The index into the templates array
public void addTemplate(String name, int match, String defvalue)
name
- The attribute namematch
- The match operator (e.g. EXACT, FINAL_STRING ..)defvalue
- The value to matchpublic void addTemplate(String name, String match, String defvalue)
name
- The attribute namematch
- The match operator as a String, e.g. '=','~', '^', '$' or '!'.defvalue
- The value to matchpublic String buildLdapFilter(SearchCriteria.rscSearch rs)
public String buildSQLFilter(SearchCriteria.rscSearch rs)
public String buildNotesFilter(SearchCriteria.rscSearch rs)
public String buildNotesFTFilter(SearchCriteria.rscSearch rs)
public String getLDAPFilter()
public String getSQLFilter()
public String getSimpleFilter()
public String getNotesFilter()
public String getNotesFTFilter()
public String getSearchString(int i)
public Entry getCurrentEntry()
Entry
public void buildCriteria(Entry e) throws Exception
When the method completes the criteria array has been built so it contains a copy of the templates array with expanded values.
You typically create an instance of this class and then add the templates. Then for each entry you are using in a search you can call the buildCriteria method to populate the criteria array. Then, having done that you can use the getLDAPFilter, getNotesFilter etc to obtain the search filter as a string.
e
- The work entry used in parameter substitution
Exception
public void buildCriteria(Entry e, BaseConfiguration config, Object task) throws Exception
Exception
public void buildCriteriaScript(Entry entry) throws Exception
entry
- The work entry used in parameter substitution
Exception
public String getScriptFilter()
public boolean isConfigured()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |