org.enhydra.shark.api.common
Interface FilterBuilder

All Known Subinterfaces:
ActivityFilterBuilder, AssignmentFilterBuilder, EventAuditFilterBuilder, ProcessFilterBuilder, ProcessMgrFilterBuilder, ResourceFilterBuilder

public interface FilterBuilder

ExpressionBuilder interface helps building expressions for any BaseIterator implementation. Experience has learned us that it's not that easy to build any useful expression to be used in xxIterators. Since Shark supports BeanShell and JavaScript, making expressions starts to be even more complicated once you start to use string literals. Also, reading and debugging of such expression might turn into very tedious task. On the other side OMG (or at least the way we read it) explicitely says set_expression method takes String as parameter, and there's no escape. ExpressionBuilder and it's extending interfaces/classes serves the intention to ease this task, although there is another benefit - it allows us to prepare such expressions xxIterator can execute directly against database, thus improving the performance.

Version:
0.2
Author:
Vladimir Puskas

Field Summary
static boolean ORDER_ASCENDING
           
static boolean ORDER_DESCENDING
           
static int SQL_TYPE_ACTIVITY
           
static int SQL_TYPE_ASSIGNMENT
           
static int SQL_TYPE_EVENT_AUDIT
           
static int SQL_TYPE_MANAGER
           
static int SQL_TYPE_PROCESS
           
static int SQL_TYPE_RESOURCE
           
 
Method Summary
 WMFilter addBshExpression(WMSessionHandle sHandle, WMFilter filter, java.lang.String exp)
          Appends arbitrary condition Here you may specify any script compatible expression, but beware complete expression will be evaluated inside Java VM , not on DB.
 WMFilter and(WMSessionHandle sHandle, WMFilter f1, WMFilter f2)
           
 WMFilter andForArray(WMSessionHandle sHandle, WMFilter[] fs)
           
 WMFilter createEmptyFilter(WMSessionHandle shandle)
           
 java.lang.String getIteratorEmptyExpression(WMSessionHandle sHandle)
           
 WMFilter not(WMSessionHandle sHandle, WMFilter f)
           
 WMFilter or(WMSessionHandle sHandle, WMFilter f1, WMFilter f2)
           
 WMFilter orForArray(WMSessionHandle sHandle, WMFilter[] fs)
           
 WMFilter setLimit(WMSessionHandle sHandle, WMFilter f, int limit)
           
 WMFilter setStartPosition(WMSessionHandle sHandle, WMFilter f, int startAt)
           
 java.lang.String toIteratorExpression(WMSessionHandle sHandle, WMFilter filter)
           
 

Field Detail

SQL_TYPE_ACTIVITY

public static final int SQL_TYPE_ACTIVITY
See Also:
Constant Field Values

SQL_TYPE_PROCESS

public static final int SQL_TYPE_PROCESS
See Also:
Constant Field Values

SQL_TYPE_MANAGER

public static final int SQL_TYPE_MANAGER
See Also:
Constant Field Values

SQL_TYPE_RESOURCE

public static final int SQL_TYPE_RESOURCE
See Also:
Constant Field Values

SQL_TYPE_ASSIGNMENT

public static final int SQL_TYPE_ASSIGNMENT
See Also:
Constant Field Values

SQL_TYPE_EVENT_AUDIT

public static final int SQL_TYPE_EVENT_AUDIT
See Also:
Constant Field Values

ORDER_ASCENDING

public static final boolean ORDER_ASCENDING
See Also:
Constant Field Values

ORDER_DESCENDING

public static final boolean ORDER_DESCENDING
See Also:
Constant Field Values
Method Detail

and

public WMFilter and(WMSessionHandle sHandle,
                    WMFilter f1,
                    WMFilter f2)
             throws java.lang.Exception
Throws:
java.lang.Exception

andForArray

public WMFilter andForArray(WMSessionHandle sHandle,
                            WMFilter[] fs)
                     throws java.lang.Exception
Throws:
java.lang.Exception

or

public WMFilter or(WMSessionHandle sHandle,
                   WMFilter f1,
                   WMFilter f2)
            throws java.lang.Exception
Throws:
java.lang.Exception

orForArray

public WMFilter orForArray(WMSessionHandle sHandle,
                           WMFilter[] fs)
                    throws java.lang.Exception
Throws:
java.lang.Exception

not

public WMFilter not(WMSessionHandle sHandle,
                    WMFilter f)
             throws java.lang.Exception
Throws:
java.lang.Exception

setStartPosition

public WMFilter setStartPosition(WMSessionHandle sHandle,
                                 WMFilter f,
                                 int startAt)
                          throws java.lang.Exception
Throws:
java.lang.Exception

setLimit

public WMFilter setLimit(WMSessionHandle sHandle,
                         WMFilter f,
                         int limit)
                  throws java.lang.Exception
Throws:
java.lang.Exception

createEmptyFilter

public WMFilter createEmptyFilter(WMSessionHandle shandle)
                           throws java.lang.Exception
Throws:
java.lang.Exception

addBshExpression

public WMFilter addBshExpression(WMSessionHandle sHandle,
                                 WMFilter filter,
                                 java.lang.String exp)
                          throws java.lang.Exception
Appends arbitrary condition

Here you may specify any script compatible expression, but beware complete expression will be evaluated inside Java VM , not on DB.

Throws:
java.lang.Exception

toIteratorExpression

public java.lang.String toIteratorExpression(WMSessionHandle sHandle,
                                             WMFilter filter)
                                      throws java.lang.Exception
Throws:
java.lang.Exception

getIteratorEmptyExpression

public java.lang.String getIteratorEmptyExpression(WMSessionHandle sHandle)
                                            throws java.lang.Exception
Throws:
java.lang.Exception