org.apache.ojb.broker.query
Class OJBSearchFilter

java.lang.Object
  extended by org.apache.ojb.broker.query.SearchFilter
      extended by org.apache.ojb.broker.query.OJBSearchFilter

public class OJBSearchFilter
extends SearchFilter

OJB Search Filter Class for ObJectRelationalBridge O/R mapping tool This class builds a search filter tree, specifing how names and values are to be compared when searching a database. This extends SearchFilter and implements the Convert method that produces the search filter string for the SQL database

Version:
$Revision: 365232 $ $Date: 2005-12-21 23:36:07 +0100 (Mi, 21 Dez 2005) $
Author:
David Forslund, koenig

Field Summary
 
Fields inherited from class org.apache.ojb.broker.query.SearchFilter
AND, EQUAL, GREATER_EQUAL, GREATER_THAN, IN, LESS_EQUAL, LESS_THAN, LIKE, NOT, NOT_EQUAL, NOT_IN, OR
 
Constructor Summary
OJBSearchFilter()
           
 
Method Summary
 void combine(SearchFilter new_filter, int op)
          Combine one other search filters with this one, using the specific operator.
 void combine(java.util.Vector new_filters, int op)
          Combine other search filters with this one, using the specific operator.
 void compareFilter(java.lang.String elementName, java.lang.String value, int oper)
          Change the search filter to one that compares an element name to a value.
 void matchList(java.lang.String elementName, int[] values, int oper)
          Change the search filter to one that specifies an element to not match one of a list of integer values.
 void matchList(java.lang.String elementName, java.lang.String[] values, int oper)
          Change the search filter to one that specifies an element to not match one of a list of values.
 void matchList(java.lang.String elementName, java.util.Vector values, int oper)
          Change the search filter to one that specifies an element to match or not match one of a list of values.
 void matchSet(java.util.Hashtable elements, int combine_op, int compare_op)
          Change the search filter to one that specifies a set of elements and their values that must match, and the operator to use to combine the elements.
 void matchSet(java.lang.String[] elementNames, java.lang.String[] elementValues, int op)
          Change the search filter to one that specifies a set of elements and their values that must match, and the operator to use to combine the elements.
 void matchValue(java.lang.String elementName, int value, int oper)
          -----------------------------------------------------------
 void matchValue(java.lang.String elementName, java.lang.String value, int oper)
          Change the search filter to one that specifies an element to not match one single value.
 java.lang.String toString()
          -----------------------------------------------------------
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

OJBSearchFilter

public OJBSearchFilter()
Method Detail

matchList

public void matchList(java.lang.String elementName,
                      java.util.Vector values,
                      int oper)
Change the search filter to one that specifies an element to match or not match one of a list of values. The old search filter is deleted.

Overrides:
matchList in class SearchFilter
Parameters:
elementName - is the name of the element to be matched
values - is a vector of possible matches
oper - is the IN or NOT_IN operator to indicate how to matche

matchList

public void matchList(java.lang.String elementName,
                      java.lang.String[] values,
                      int oper)
Change the search filter to one that specifies an element to not match one of a list of values. The old search filter is deleted.

Overrides:
matchList in class SearchFilter
Parameters:
elementName - is the name of the element to be matched
values - is an array of possible matches
oper - is the IN or NOT_IN operator to indicate how to matche

matchList

public void matchList(java.lang.String elementName,
                      int[] values,
                      int oper)
Change the search filter to one that specifies an element to not match one of a list of integer values. The old search filter is deleted.

Overrides:
matchList in class SearchFilter
Parameters:
elementName - is the name of the element to be matched
values - is an array of possible integer matches
oper - is the IN or NOT_IN operator to indicate how to matche

matchValue

public void matchValue(java.lang.String elementName,
                       java.lang.String value,
                       int oper)
Change the search filter to one that specifies an element to not match one single value. The old search filter is deleted.

Overrides:
matchValue in class SearchFilter
Parameters:
elementName - is the name of the element to be matched
value - is the value to not be matched
oper - is the IN or NOT_IN operator to indicate how to matche

matchValue

public void matchValue(java.lang.String elementName,
                       int value,
                       int oper)
-----------------------------------------------------------

Overrides:
matchValue in class SearchFilter
Parameters:
elementName -
value -
oper -

compareFilter

public void compareFilter(java.lang.String elementName,
                          java.lang.String value,
                          int oper)
                   throws DBException
Change the search filter to one that compares an element name to a value. The old search filter is deleted.

Overrides:
compareFilter in class SearchFilter
Parameters:
elementName - is the name of the element to be tested
value - is the value to be compared against
oper - is the binary comparison operator to be used
Throws:
DBException

matchSet

public void matchSet(java.util.Hashtable elements,
                     int combine_op,
                     int compare_op)
              throws DBException
Change the search filter to one that specifies a set of elements and their values that must match, and the operator to use to combine the elements. Each key is compared for an equal match to the value, and all comparisons are combined by the specified logical operator (OR or AND). The old search filter is deleted.

Overrides:
matchSet in class SearchFilter
Parameters:
elements - is a hashtable holding key-value pairs
combine_op - is the logical operator to be used to combine the comparisons
compare_op - is the binary operator to be used for the comparisons
Throws:
DBException

matchSet

public void matchSet(java.lang.String[] elementNames,
                     java.lang.String[] elementValues,
                     int op)
              throws DBException
Change the search filter to one that specifies a set of elements and their values that must match, and the operator to use to combine the elements. Each element name is compared for an equal match to the value, and all comparisons are combined by the specified logical operator (OR or AND). The old search filter is deleted.

Overrides:
matchSet in class SearchFilter
Parameters:
elementNames - is an array of names of elements to be tested
elementValues - is an array of values for the corresponding element
op - is the logical operator to be used to combine the comparisons
Throws:
DBException

combine

public void combine(java.util.Vector new_filters,
                    int op)
             throws DBException
Combine other search filters with this one, using the specific operator.

Overrides:
combine in class SearchFilter
Parameters:
new_filters - is a vector of SearchFilter classes to be combined
op - is the logical operator to be used to combine the filters
Throws:
DBException

combine

public void combine(SearchFilter new_filter,
                    int op)
             throws DBException
Combine one other search filters with this one, using the specific operator.

Overrides:
combine in class SearchFilter
Parameters:
new_filter - is the SearchFilter class to be combined
op - is the logical operator to be used to combine the filters
Throws:
DBException

toString

public java.lang.String toString()
-----------------------------------------------------------

Specified by:
toString in class SearchFilter
Returns:


(C) 2002 - 2006 Apache Software Foundation
All rights reserved. Published under the Apache License 2.0.
http://db.apache.org/ojb
Version: 1.0.4, 2005-12-30