com.bea.apps.groupspace.search.utils
Class ExpressionBuilder

java.lang.Object
  extended by com.bea.apps.groupspace.search.utils.ExpressionBuilder

public class ExpressionBuilder
extends Object

Use this class to build up expressions for use in the CmExpressionSearchControl and GsExpressionSearchControl


Nested Class Summary
static class ExpressionBuilder.CountCriteria
           
static class ExpressionBuilder.DateCriteria
           
 
Field Summary
static Map<ExpressionBuilder.CountCriteria,String> countMap
           
static Map<ExpressionBuilder.DateCriteria,String> dateMap
           
 
Constructor Summary
ExpressionBuilder()
           
 
Method Summary
 Expression and(Expression[] exprs)
          'AND' all these criteria.
 Expression and(Expression expr1, Expression expr2)
          'AND' the two criterial Note these two expressions must each be an "equals" expression.
 Expression and(Expression expr1, Expression[] exprs)
          'AND' all these criteria.
 Expression contains(String property, String criteria, boolean anywhere)
          Find items whose property contains exactly this criteria.
 Expression containsAll(String property, String[] criteria)
          Find items whose property contains all of these criteria.
 Expression containsAny(String property, String[] criteria)
          Find items whose property contains any of these criteria.
 Expression countCriteria(String property, int count, ExpressionBuilder.CountCriteria criteria)
          Construct the Expression to limit based on count.
 Expression dateCriteria(String property, String date, ExpressionBuilder.DateCriteria criteria)
          Construct the Expression to limit the date of the search.
protected static void debug(Expression exp)
           
protected static void debug(StringBuffer buf)
           
 Expression equals(String property, String criteria)
          Include this property in the search.
 Expression join(Expression exp1, Expression exp2, boolean isOr)
          Join, taking into account some nulls.
 Expression like(String property, String criteria, boolean ignoreCase)
          Find items whose property contains something similar to this criteria.
 Expression not(String property, String criteria)
          Excludes this property from the search.
 Expression not(String property, String[] criteria)
          Excludes this property from the search.
 Expression or(Expression expr1, Expression expr2)
          'OR' the two criteria.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dateMap

public static Map<ExpressionBuilder.DateCriteria,String> dateMap

countMap

public static Map<ExpressionBuilder.CountCriteria,String> countMap
Constructor Detail

ExpressionBuilder

public ExpressionBuilder()
Method Detail

dateCriteria

public Expression dateCriteria(String property,
                               String date,
                               ExpressionBuilder.DateCriteria criteria)
Construct the Expression to limit the date of the search. For example, to find all books published before Jan 12, 2004: dateCriteria("pub_date", "01-12-2004", DateCriteria.BEFORE). Format for date is MM-DD-YYYY


countCriteria

public Expression countCriteria(String property,
                                int count,
                                ExpressionBuilder.CountCriteria criteria)
Construct the Expression to limit based on count. For example, to retrieve items with the 'viewed' property value of 'less than three': countCriteria("viewed", 3, CountCriteria.LT);


not

public Expression not(String property,
                      String criteria)
Excludes this property from the search. For example, to find all items where the 'genre' property is not 'mystery': not("genre", "mystery")


not

public Expression not(String property,
                      String[] criteria)
Excludes this property from the search. For example, to find all items where the 'cm_objectClass' is not 'FOLDER' or 'LINK' or 'ISSUE': not("genre", "mystery")


equals

public Expression equals(String property,
                         String criteria)
Include this property in the search. For example, to find all items where the 'genre' property is equal to 'mystery': equals("genre", "mystery")


contains

public Expression contains(String property,
                           String criteria,
                           boolean anywhere)
Find items whose property contains exactly this criteria. Wildcards are not allowed; use the "like" construct for that. If "anywhere" is set to true, then the word will be searched for anywhere in the content. This means 'pen' will match "pen", " pen", "open ", and "opening". In this case, it's probably best to use a full text search control.


containsAll

public Expression containsAll(String property,
                              String[] criteria)
Find items whose property contains all of these criteria. Wildcards are not allowed; use the "like" construct for that.


containsAny

public Expression containsAny(String property,
                              String[] criteria)
Find items whose property contains any of these criteria. Wildcards are not allowed; use the "like" construct for that.


like

public Expression like(String property,
                       String criteria,
                       boolean ignoreCase)
Find items whose property contains something similar to this criteria. Wildcards are allowed.


and

public Expression and(Expression[] exprs)
'AND' all these criteria. Note all of these expressions must each be an "equals" expression.


and

public Expression and(Expression expr1,
                      Expression[] exprs)
'AND' all these criteria. Note all of these expressions must each be an "equals" expression.


and

public Expression and(Expression expr1,
                      Expression expr2)
'AND' the two criterial Note these two expressions must each be an "equals" expression.


or

public Expression or(Expression expr1,
                     Expression expr2)
'OR' the two criteria. Note these two expressions must each be an "equals" expression.


join

public Expression join(Expression exp1,
                       Expression exp2,
                       boolean isOr)
Join, taking into account some nulls. Returns null if both are null, 'and' or '0r' if both are not null, and either/or of the non-null parameters otherwise. Note these two expressions must each be an "equals" expression.


debug

protected static void debug(StringBuffer buf)

debug

protected static void debug(Expression exp)


Copyright © 2006 BEA Systems, Inc. All Rights Reserved