com.webmethods.caf.faces.data.task.impl
Class TaskSearchQueryTerm

java.lang.Object
  extended by com.webmethods.caf.faces.data.task.impl.TaskSearchQueryTerm
All Implemented Interfaces:
Serializable

public class TaskSearchQueryTerm
extends Object
implements Serializable

TaskSearchQueryTerm represents task search Query term implementation. The search term can be task fields or field bindings.

See Also:
Serialized Form

Constructor Summary
TaskSearchQueryTerm()
          Default constructor
TaskSearchQueryTerm(String[] fields, String operator)
          Construct a new task search term using given fields and operator.
TaskSearchQueryTerm(String[] fields, String operator, Object value)
          Construct a new task search term using given fields, operator and value.
TaskSearchQueryTerm(String[] fields, String operator, Object value, boolean caseInsensitive)
          Construct a new task search term using given fields, operator, value and the flag indicates whether search should be case insensitive.
TaskSearchQueryTerm(String field, String operator)
          Construct a new task search term using given field and operator.
TaskSearchQueryTerm(String field, String operator, Object value)
          Construct a new task search term using given field, operator, and value.
TaskSearchQueryTerm(TaskSearchQueryTerm term)
          Copy constructor
 
Method Summary
 ValueBinding getFieldBinding()
          Returns first element of field bindings or null if there is no field bindings defined.
 ValueBinding[] getFieldBindings()
          Return field value bindings as they were set or create a them from the fields array.
 String[] getFields()
          Return search fields.
 boolean getMatchedValue()
          Returns flag which indicates if the search term matches the task
 String getOperator()
          Returns search operator
 Object getValue()
          Returns search value for this term
 boolean isCaseInsensitive()
          Returns flag if search term should implement case-insensitive search when comparing string.
 boolean matches(FacesContext facesContext)
          Check whether the search term match the information defined in faces context.
protected  void reset()
          Resets searach term state
 void setCaseInsensitive(boolean insensitive)
          Sets flag if search term should implement case-insensitive search
 void setFieldBinding(ValueBinding fieldBinding)
          Set field bindings to search.
 void setFieldBindings(ValueBinding[] fieldBindings)
          Set field bindings to search on.
 void setFields(String[] fields)
          Set fields to search.
 void setMatched(boolean matched)
          Set the flag indicates whether the search term matches the task
 void setOperator(String operator)
          Sets search operator.
 void setValue(Object value)
          Set search value for the term.
 String toString()
           
 void validate()
          Validates current search query term.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TaskSearchQueryTerm

public TaskSearchQueryTerm()
Default constructor


TaskSearchQueryTerm

public TaskSearchQueryTerm(TaskSearchQueryTerm term)
Copy constructor

Parameters:
term - search term to copy from

TaskSearchQueryTerm

public TaskSearchQueryTerm(String field,
                           String operator)
Construct a new task search term using given field and operator. Set the value as null and the search should be case insensitive.

Parameters:
field - name of the search field
operator - search operator

TaskSearchQueryTerm

public TaskSearchQueryTerm(String[] fields,
                           String operator)
Construct a new task search term using given fields and operator. Set the value as null and the search should be case insensitive.

Parameters:
fields - names of the search fields
operator - search operator

TaskSearchQueryTerm

public TaskSearchQueryTerm(String field,
                           String operator,
                           Object value)
Construct a new task search term using given field, operator, and value.

Parameters:
fields - name of the search field
operator - search operator
value - search value

TaskSearchQueryTerm

public TaskSearchQueryTerm(String[] fields,
                           String operator,
                           Object value)
Construct a new task search term using given fields, operator and value.

Parameters:
fields - names of the search fields
operator - search operator
value - search value

TaskSearchQueryTerm

public TaskSearchQueryTerm(String[] fields,
                           String operator,
                           Object value,
                           boolean caseInsensitive)
Construct a new task search term using given fields, operator, value and the flag indicates whether search should be case insensitive.

Parameters:
fields - names of the search fields
operator - search operator
value - search value
caseInsensitive - whether to use case-insensitive search for string comparisons
Method Detail

getFields

public String[] getFields()
Return search fields. Construct fields based on field bindings if the fields are not defined.

Returns:
the fields could be null if neither fields nor field binding expression are defined.

setFields

public void setFields(String[] fields)
Set fields to search. Setting fields will override any previously set value in TaskSearchQueryTerm.setFieldBindings(ValueBinding[])(String[])

Parameters:
fields - the fields to set

getFieldBinding

public ValueBinding getFieldBinding()
Returns first element of field bindings or null if there is no field bindings defined.


setFieldBinding

public void setFieldBinding(ValueBinding fieldBinding)
Set field bindings to search. Setting field bindings will override any previously set value in TaskSearchQueryTerm.setFields(String[])

Parameters:
field - the field to set

getFieldBindings

public ValueBinding[] getFieldBindings()
Return field value bindings as they were set or create a them from the fields array. Construct the field bindings based on fields information if field bindings is null.

Returns:
array of value bindings for fields

setFieldBindings

public void setFieldBindings(ValueBinding[] fieldBindings)
Set field bindings to search on. Setting field bindings will override any previously set value in TaskSearchQueryTerm.setFields(String[])

Parameters:
field - the field to set

getOperator

public String getOperator()
Returns search operator


setOperator

public void setOperator(String operator)
Sets search operator.


getValue

public Object getValue()
Returns search value for this term


isCaseInsensitive

public boolean isCaseInsensitive()
Returns flag if search term should implement case-insensitive search when comparing string. This is valid only for non-indexed search. For indexed searches strings comparison is done in the database according to database rules (typically case-sensitive)


setCaseInsensitive

public void setCaseInsensitive(boolean insensitive)
Sets flag if search term should implement case-insensitive search

Parameters:
insensitive -

setValue

public void setValue(Object value)
Set search value for the term. The value to be set depends on the type of field used and an operator It can be either java primitive object, or it can be an array of objects for "in" and "between" operators

Parameters:
value - the value to set

setMatched

public void setMatched(boolean matched)
Set the flag indicates whether the search term matches the task

Parameters:
matched -

getMatchedValue

public boolean getMatchedValue()
Returns flag which indicates if the search term matches the task


matches

public boolean matches(FacesContext facesContext)
                throws Exception
Check whether the search term match the information defined in faces context. This method can be overridden to implement a fully custom searching.

Returns:
true if current search term matches the task set on the facesContext. The task can be retrieved from facesContext via #{currentTask} binding expression
Throws:
Exception

validate

public void validate()
              throws Exception
Validates current search query term.

Throws:
Exception

reset

protected void reset()
Resets searach term state


toString

public String toString()
Overrides:
toString in class Object