*
Metamerge logo
Search

Advanced Search
*
*
*
* HOME DOCUMENTS & RESOURCES DOWNLOADS EARLY TECH ACCESS SUPPORT FAQ KNOWN ISSUES OLD VERSIONS
*

com.architech
Class rscSearchCriteria

java.lang.Object
  |
  +--com.architech.rscSearchCriteria

public class rscSearchCriteria
extends java.lang.Object

This class contains a list of generic criteria statements (e.g. attr equals value) and also 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.architech.entry.Entry object. The expanded templates can then be accessed through the criteria methods.

The typical use of this class is to:

  • Create an instance of this class
  • Populate the templates array (addTemplate method)
Then for every entry you can use the buildCriteria method to expand the templates into the criteria array and use the getLDAPFilter etc to construct a search filter usable with specific connectors. The connectors themselves will use the getXXFilter methods to obtain the search filter in order to search for entries. However, if you write your own connector or for some other reason need to get hold of the expanded filters you can always use the getXX>Filter methods. These methods only build a string from the criteria array so no changes are done to the class variables.


Inner Class Summary
 class rscSearchCriteria.rscSearch
          This class is used internally.
 
Field Summary
static int EXCACT
           
static int FINAL_STRING
           
static int INITIAL_STRING
           
static int NOT_STRING
           
static int SEARCH_AND
           
static int SEARCH_NOT
           
static int SEARCH_OR
           
static int SUBSTRING
           
 
Constructor Summary
rscSearchCriteria()
           
rscSearchCriteria(int matchtype)
           
rscSearchCriteria(java.lang.String name, int match, java.lang.Object value)
           
 
Method Summary
 void addCriteria(java.lang.String name, int match, java.lang.Object value)
          Add expression to criteria array.
 void addCriteria(java.lang.String name, int match, java.lang.Object value, boolean negate)
          Add expression to criteria array.
 void addTemplate(java.lang.String name, int match, java.lang.String defvalue)
          Add a criteria to the templates array.
 void buildCriteria(com.architech.entry.EntryInterface e)
          Build the criteria array using provided entry.
 java.lang.String buildLdapFilter(rscSearchCriteria.rscSearch rs)
          Constructs an LDAP search filter from an rscSearch class.
 java.lang.String buildNotesFilter(rscSearchCriteria.rscSearch rs)
          Constructs an Notes search filter from an rscSearch class.
 java.lang.String buildNotesFTFilter(rscSearchCriteria.rscSearch rs)
          Constructs an Notes FullText search filter from an rscSearch class.
 java.lang.String buildSQLFilter(rscSearchCriteria.rscSearch rs)
          Constructs an SQL where expression from an rscSearch class.
 rscSearchCriteria.rscSearch getCriteria(int index)
          Return criteria class at specified index.
 com.architech.entry.EntryInterface getCurrentEntry()
          Return the working entry used to generate the criteria array from the templates array.
 int getFirstCriteriaMatch()
          Return match operator of first criteria entry.
 java.lang.String getFirstCriteriaName()
          Return name of first criteria entry.
 java.lang.String getFirstCriteriaValue()
          Return value of first criteria entry.
 java.lang.String getLDAPFilter()
          Return complete LDAP filter from criteria array.
 java.lang.String getNotesFilter()
          Return complete Notes search expression from criteria array.
 java.lang.String getNotesFTFilter()
          Return complete Notes FullText search expression from criteria array.
 java.lang.String getSearchString(int i)
           
 java.lang.String getSimpleFilter()
           
 java.lang.String getSQLFilter()
          Return complete SQL search expression from criteria array.
 rscSearchCriteria.rscSearch getTemplate(int index)
          Returns the criteria template at a specific location.
 int getType()
          Return search type.
 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
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EXCACT

public static final int EXCACT

SUBSTRING

public static final int SUBSTRING

INITIAL_STRING

public static final int INITIAL_STRING

FINAL_STRING

public static final int FINAL_STRING

NOT_STRING

public static final int NOT_STRING

SEARCH_AND

public static final int SEARCH_AND

SEARCH_OR

public static final int SEARCH_OR

SEARCH_NOT

public static final int SEARCH_NOT
Constructor Detail

rscSearchCriteria

public rscSearchCriteria()

rscSearchCriteria

public rscSearchCriteria(int matchtype)

rscSearchCriteria

public rscSearchCriteria(java.lang.String name,
                         int match,
                         java.lang.Object value)
Method Detail

size

public int size()
Return number of templates.
Returns:
Number of entries in the templates array

getCriteria

public rscSearchCriteria.rscSearch getCriteria(int index)
Return criteria class at specified index.
Returns:
The rscSearch class at the specified index

addCriteria

public void addCriteria(java.lang.String name,
                        int match,
                        java.lang.Object value)
Add expression to criteria array.
Parameters:
name - The attribute name
match - The match operator (e.g. EXCACT, FINAL_STRING ..)
value - The matching value.

addCriteria

public void addCriteria(java.lang.String name,
                        int match,
                        java.lang.Object value,
                        boolean negate)
Add expression to criteria array.
Parameters:
name - The attribute name
match - The match operator (e.g. EXCACT, FINAL_STRING ..)
value - The matching value.
negate - Specify true to negate the expression

getFirstCriteriaName

public java.lang.String getFirstCriteriaName()
Return name of first criteria entry.
Returns:
The name contained in the first criteria entry

getFirstCriteriaValue

public java.lang.String getFirstCriteriaValue()
Return value of first criteria entry.
Returns:
The value contained in the first criteria entry

getFirstCriteriaMatch

public int getFirstCriteriaMatch()
Return match operator of first criteria entry.
Returns:
The match operator contained in the first criteria entry

setType

public void setType(int type)
Set type (SEARCH_AND, SEARCH_OR) for the search criteria. This govers how multiple criterias are constructed.
Parameters:
type - SEARCH_AND, SEARCH_OR

getType

public int getType()
Return search type.
Returns:
SEARCH_AND or SEARCH_OR

getTemplate

public rscSearchCriteria.rscSearch getTemplate(int index)
Returns the criteria template at a specific location.
Parameters:
index - The index into the templates array
Returns:
The rscSearch class at location index

addTemplate

public void addTemplate(java.lang.String name,
                        int match,
                        java.lang.String defvalue)
Add a criteria to the templates array.
Parameters:
name - The attribute name
match - The match operator (e.g. EXCACT, FINAL_STRING ..)
defvalue - The default value

buildLdapFilter

public java.lang.String buildLdapFilter(rscSearchCriteria.rscSearch rs)
Constructs an LDAP search filter from an rscSearch class.
Returns:
The LDAP search filter

buildSQLFilter

public java.lang.String buildSQLFilter(rscSearchCriteria.rscSearch rs)
Constructs an SQL where expression from an rscSearch class.
Returns:
The SQL where expression

buildNotesFilter

public java.lang.String buildNotesFilter(rscSearchCriteria.rscSearch rs)
Constructs an Notes search filter from an rscSearch class.
Returns:
The Notes search filter

buildNotesFTFilter

public java.lang.String buildNotesFTFilter(rscSearchCriteria.rscSearch rs)
Constructs an Notes FullText search filter from an rscSearch class.
Returns:
The Notes FullText search filter

getLDAPFilter

public java.lang.String getLDAPFilter()
Return complete LDAP filter from criteria array.
Returns:
The complete LDAP filter from the values in the criteria array.

getSQLFilter

public java.lang.String getSQLFilter()
Return complete SQL search expression from criteria array.
Returns:
The complete SQL search expression from the values in the criteria array.

getSimpleFilter

public java.lang.String getSimpleFilter()

getNotesFilter

public java.lang.String getNotesFilter()
Return complete Notes search expression from criteria array.
Returns:
The complete Notes search expression from the values in the criteria array.

getNotesFTFilter

public java.lang.String getNotesFTFilter()
Return complete Notes FullText search expression from criteria array.
Returns:
The complete Notes FullText search expression from the values in the criteria array.

getSearchString

public java.lang.String getSearchString(int i)

getCurrentEntry

public com.architech.entry.EntryInterface getCurrentEntry()
Return the working entry used to generate the criteria array from the templates array.
Returns:
The working entry
See Also:
Entry

buildCriteria

public void buildCriteria(com.architech.entry.EntryInterface e)
                   throws java.lang.Exception
Build the criteria array using provided entry. This method uses the templates array to generate the criteria array. Each criteria in the template array holds an attribute name, a matching operator and a value. The value, if prefixed by a dollar sign, causes this method to substitute the value with the corresponding attribute value in the work entry. The attribute name is derived from the value by removing the first dollar sign using the remainder as the attribute name. For example, "$test" becomes "test".

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.

Parameters:
e - The work entry used in parameter substitution


*
  Metamerge Integrator version 4.5 ©Copyright Metamerge AS 2000-2002 Last edited 2002-04-30 contact us