org.enhydra.shark.api.common
Interface FilterBuilder

All Known Subinterfaces:
ActivityEventAuditFilterBuilder, ActivityFilterBuilder, AssignmentFilterBuilder, DataEventAuditFilterBuilder, ProcessEventAuditFilterBuilder, ProcessFilterBuilder, ProcessMgrFilterBuilder, ResourceEventAuditFilterBuilder, ResourceFilterBuilder, VariableFilterBuilder

public interface FilterBuilder

FilterBuilder interface helps building expressions for any BaseIterator implementation or methods using filters as input parameter. 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. FilterBuilder 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
           
static int SQL_TYPE_VARIABLE
           
 
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

static final int SQL_TYPE_ACTIVITY
See Also:
Constant Field Values

SQL_TYPE_PROCESS

static final int SQL_TYPE_PROCESS
See Also:
Constant Field Values

SQL_TYPE_MANAGER

static final int SQL_TYPE_MANAGER
See Also:
Constant Field Values

SQL_TYPE_RESOURCE

static final int SQL_TYPE_RESOURCE
See Also:
Constant Field Values

SQL_TYPE_ASSIGNMENT

static final int SQL_TYPE_ASSIGNMENT
See Also:
Constant Field Values

SQL_TYPE_EVENT_AUDIT

static final int SQL_TYPE_EVENT_AUDIT
See Also:
Constant Field Values

SQL_TYPE_VARIABLE

static final int SQL_TYPE_VARIABLE
See Also:
Constant Field Values

ORDER_ASCENDING

static final boolean ORDER_ASCENDING
See Also:
Constant Field Values

ORDER_DESCENDING

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

and

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

andForArray

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

or

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

orForArray

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

not

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

setStartPosition

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

setLimit

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

createEmptyFilter

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

addBshExpression

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

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

getIteratorEmptyExpression

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