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

java.lang.Object
  extended by com.webmethods.caf.faces.data.task.impl.TaskSearchQuery
All Implemented Interfaces:
ITaskConstants, ITaskSearchQuery, Serializable
Direct Known Subclasses:
TaskInboxSearchContentProvider.InboxSearchQuery, TaskSearchQueryV2

public class TaskSearchQuery
extends Object
implements ITaskSearchQuery, Serializable

TaskSearchQuery is the concrete implementation of ITaskSearchQuery.

See Also:
Serialized Form

Field Summary
 
Fields inherited from interface com.webmethods.caf.faces.data.task.ITaskSearchQuery
OPERATOR_AND, OPERATOR_BETWEEN, OPERATOR_CONTAINS, OPERATOR_EQUALS, OPERATOR_EQUALS_OR_LESS, OPERATOR_EQUALS_OR_MORE, OPERATOR_IN, OPERATOR_IS_NOT_NULL, OPERATOR_IS_NULL, OPERATOR_LESS, OPERATOR_LIKE, OPERATOR_MORE, OPERATOR_NOT_EQUALS, OPERATOR_NOT_IN, OPERATOR_NOT_LIKE, OPERATOR_OR, SORT_ORDER_ASCENDING, SORT_ORDER_DESCENDING
 
Fields inherited from interface com.webmethods.caf.faces.data.task.ITaskConstants
OPERATION_ACCEPTED, OPERATION_CREATED, OPERATION_DELEGATION_RULE, OPERATION_DIST_FILTER_RULE, OPERATION_DIST_RULE, OPERATION_ERROR, OPERATION_RESUME, OPERATION_REVERTED, OPERATION_SCHEDULE_RULE, OPERATION_SUSPEND, OPERATION_TRIGGER_RULE, OPERATION_UNACCEPTED, OPERATION_UPDATE, PRIORITY_CRITICAL, PRIORITY_HIGH, PRIORITY_LOW, PRIORITY_MEDIUM, PRIORITY_NONE, STATUS_ACTIVE, STATUS_CANCELLED, STATUS_COMPLETED, STATUS_ERROR, STATUS_EXPIRED, STATUS_NEW, STATUS_SUSPENDED, STATUS_UNDEFINED, TASK_DATA_BINDING, TASK_DATA_BINDING_PREFIX, TASK_DATA_PROPERTY_PREFIX, TASK_FIELD_ACCEPT_BY_CSV, TASK_FIELD_ACCEPT_BY_NAME, TASK_FIELD_ACCEPT_BY_URI, TASK_FIELD_ACCEPTED_BY_CURRENT, TASK_FIELD_ACCEPTED_BY_LIST, TASK_FIELD_ASSIGNED_TO_CSV, TASK_FIELD_ASSIGNED_TO_LIST, TASK_FIELD_ASSIGNED_TO_NAME, TASK_FIELD_ASSIGNED_TO_URI, TASK_FIELD_ATTRIBUTES, TASK_FIELD_AUDIT_CONTEXT, TASK_FIELD_COLLABORATION_PROCESS_ID, TASK_FIELD_COLLABORATION_STEP_ID, TASK_FIELD_CREATED_BY, TASK_FIELD_CREATED_BY_NAME, TASK_FIELD_CREATED_BY_URI, TASK_FIELD_CREATED_DATE, TASK_FIELD_CUSTOM_TASK_ID, TASK_FIELD_DELEGATED_FROM_LIST, TASK_FIELD_DELEGATED_TO_LIST, TASK_FIELD_DESCRIPTION, TASK_FIELD_ERROR_CODE, TASK_FIELD_ERROR_MESSAGE, TASK_FIELD_EXPIRE_DATE, TASK_FIELD_FOR_PROCESS, TASK_FIELD_LAST_ACCEPTED_BY, TASK_FIELD_LAST_ACCEPTED_BY_NAME, TASK_FIELD_LAST_ACCEPTED_DATE, TASK_FIELD_LAST_MODIFIED_BY, TASK_FIELD_LAST_MODIFIED_BY_NAME, TASK_FIELD_LAST_MODIFIED_BY_URI, TASK_FIELD_LAST_MODIFIED_DATE, TASK_FIELD_NAME, TASK_FIELD_PARENT_TASK_ID, TASK_FIELD_PRIORITY, TASK_FIELD_PRIORITY_NAME, TASK_FIELD_PROCESS_INSTANCE_ID, TASK_FIELD_PROCESS_ITERATION, TASK_FIELD_PROCESS_MODEL_ID, TASK_FIELD_PROCESS_MODEL_VERSION, TASK_FIELD_PROCESSED_RULES_LIST, TASK_FIELD_STATUS, TASK_FIELD_STATUS_NAME, TASK_FIELD_STEP_ID, TASK_FIELD_STEP_ITERATION, TASK_FIELD_TASK_DATA, TASK_FIELD_TASK_ID, TASK_FIELD_TASK_TYPE_ID, TASK_FIELD_TASK_TYPE_NAME, TASK_FIELD_TASK_TYPE_URI, TASK_FIELD_TASK_URL, TASK_FIELD_UNACCEPT_FROM_NAME, TASK_FIELD_UNACCEPT_FROM_URI, TASK_FIELD_VERSION, TASK_INFO_BINDING, TASK_INFO_BINDING_PREFIX, TASK_OPERATION_ACCEPTED, TASK_OPERATION_ASSIGNMENT_CHANGED, TASK_OPERATION_ATTACHMENT_ADDED, TASK_OPERATION_ATTACHMENT_DELETED, TASK_OPERATION_ATTACHMENT_UPDATED, TASK_OPERATION_CANCEL, TASK_OPERATION_COMMENT_ADDED, TASK_OPERATION_COMMENT_DELETED, TASK_OPERATION_COMMENT_UPDATED, TASK_OPERATION_COMPLETE, TASK_OPERATION_CREATED, TASK_OPERATION_DELEGATION_CHANGED, TASK_OPERATION_DELEGATION_RULE_FIRED, TASK_OPERATION_DISTRIBUTION_RULE_FIRED, TASK_OPERATION_ERROR, TASK_OPERATION_EXPIRE, TASK_OPERATION_NOTIFICATION, TASK_OPERATION_REPLY, TASK_OPERATION_RESUME, TASK_OPERATION_REVERTED, TASK_OPERATION_ROLLEDBACK, TASK_OPERATION_SCHEDULE_RULE_FIRED, TASK_OPERATION_SINK_REQUEST, TASK_OPERATION_START, TASK_OPERATION_STOP, TASK_OPERATION_SUSPEND, TASK_OPERATION_TRIGGER_RULE_FIRED, TASK_OPERATION_UNACCEPTED, TASK_OPERATION_UNHANDLED_ERROR, TASK_OPERATION_UPDATE, TASK_PRIORITY_CRITICAL, TASK_PRIORITY_HIGH, TASK_PRIORITY_LOW, TASK_PRIORITY_MEDIUM, TASK_PRIORITY_NONE, TASK_STATUS_ACTIVE, TASK_STATUS_CANCELLED, TASK_STATUS_COMPLETED, TASK_STATUS_ERROR, TASK_STATUS_EXPIRED, TASK_STATUS_NEW, TASK_STATUS_SUSPENDED, TASK_STATUS_UNDEFINED, TASK_TAGS
 
Constructor Summary
TaskSearchQuery()
          Default constructor which doesn't do any initialization.
TaskSearchQuery(TaskSearchQuery taskQuery)
          Copy constructor
 
Method Summary
 TaskSearchQueryTerm addQueryTerm(String[] fields, String operator, Object value)
          Creates new search term using the parameters provided and add the newly created search term to this search query.
 TaskSearchQueryTerm findTerm(String fieldName)
          Find the search term based on the fieldName specified.
 TaskSearchQueryTerm findTerm(String fieldName, String operator)
          Find the search term based on the fieldName and operator specified.
 long getInvocationID()
           
 int getMaxResults()
          Returns max results to be returned.
 String getPrincipalID()
          Returns principalID whose inbox should be searched.
 TaskSearchQueryTerm[] getTerms()
          Returns search query terms
 boolean isCheckPermissions()
          Returns flag if current user permission should be checked for the task searches.
 boolean isDoNotShowAcceptedByOthers()
          Whether query should display tasks accepted by other principals
 boolean isShowNonActiveTasks()
          Returns flag to show non active tasks in the search result.
 boolean matches(FacesContext facesContext)
          Evaluates query against task set on facesContext.
 boolean removeQueryTerm(TaskSearchQueryTerm term)
          Removes a search term from this query
 void reset()
          Resets a query before search.
 void setCheckPermissions(boolean permissions)
          Set the flag to indicate if current user permission should be checked for the task search.
 void setDoNotShowAcceptedByOthers(boolean doNotShow)
          Whether query should display tasks accepted by other principals
 void setInvocationID(long m_invocationid)
          Set the ID of the search invocation.
 void setMaxResults(int maxResults)
          Set the max result count
 void setPrincipalID(String principalID)
          Sets principalID whose inbox should be searched.
 void setShowNonActiveTasks(boolean nonActiveTasks)
          Set the flag to indicate whether the search result should show non active tasks.
 void setTerms(TaskSearchQueryTerm[] terms)
          Set search term list for this query
 String toString()
          
 void validate()
          Validates this query, throws any error exception if query is not valid
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TaskSearchQuery

public TaskSearchQuery()
Default constructor which doesn't do any initialization.


TaskSearchQuery

public TaskSearchQuery(TaskSearchQuery taskQuery)
Copy constructor

Parameters:
taskQuery - task query to copy from
Method Detail

getMaxResults

public int getMaxResults()
Returns max results to be returned. Default = -1, means no maximum is set
This is ignored when using task indexed searches. For indexed searches full count is always determined and only current page is returned.


setMaxResults

public void setMaxResults(int maxResults)
Set the max result count

Parameters:
maxResults - max results. Set to -1 to return everything

isShowNonActiveTasks

public boolean isShowNonActiveTasks()
Returns flag to show non active tasks in the search result. Default is false
This only valid for inbox type searches. See ITaskSearchContentProvider.setSearchInbox(boolean)


setShowNonActiveTasks

public void setShowNonActiveTasks(boolean nonActiveTasks)
Set the flag to indicate whether the search result should show non active tasks.
This only valid for inbox type searches

Parameters:
nonActiveTasks - flag to show non-active tasks

isCheckPermissions

public boolean isCheckPermissions()
Returns flag if current user permission should be checked for the task searches. Default is true


setCheckPermissions

public void setCheckPermissions(boolean permissions)
Set the flag to indicate if current user permission should be checked for the task search.

Parameters:
permissions - permissions check flag

setTerms

public void setTerms(TaskSearchQueryTerm[] terms)
Set search term list for this query

Parameters:
terms - array of search terms

getTerms

public TaskSearchQueryTerm[] getTerms()
Returns search query terms

Returns:
array of search terms

findTerm

public TaskSearchQueryTerm findTerm(String fieldName,
                                    String operator)
Find the search term based on the fieldName and operator specified. Return null if there is no match.

Parameters:
fieldName - field name to search
operator - operator to search
Returns:
found search term or null

findTerm

public TaskSearchQueryTerm findTerm(String fieldName)
Find the search term based on the fieldName specified. Return null if there is no match.

Parameters:
fieldName - field name to find term for
Returns:
search term or null. It there are more than one term for the same field name it will return only first term

getPrincipalID

public String getPrincipalID()
Returns principalID whose inbox should be searched. If null then current user is assumed


setPrincipalID

public void setPrincipalID(String principalID)
Sets principalID whose inbox should be searched. If null then current user is assumed


addQueryTerm

public TaskSearchQueryTerm addQueryTerm(String[] fields,
                                        String operator,
                                        Object value)
Creates new search term using the parameters provided and add the newly created search term to this search query.

Parameters:
fields - search fields array to be used for this search term.

See ITaskSearchQuery for list of available task info fields

To specify business data fields for non-indexed searches you need to pass in a string value of field binding expression as #{currentTask.taskData.path_to_business_data_field. For example #{currentTask.taskData.order.orderNumber}

To specify business data fields for indexed searches you need to pass in field as index name defined for this field
operator - search operator. See ITaskSearchQuery for list of available operators
value - search value
Returns:
the newly created and added search term.

removeQueryTerm

public boolean removeQueryTerm(TaskSearchQueryTerm term)
Removes a search term from this query

Parameters:
term - term to be removed
Returns:
true if term was removed

matches

public boolean matches(FacesContext facesContext)
                throws Exception
Evaluates query against task set on facesContext. This calls into TaskSearchQueryTerm.matches(FacesContext) for every term defined for this task. Some terms may implement a search in the database (for most TaskInfo fields). If term implements its search in the database, then this term is ignored as it already been evaluated.

Parameters:
facesContext - current facesContext. The current task is available on the context by #{currentTask} binding expression
Returns:
true if all terms from this query match the current task
Throws:
Exception

reset

public void reset()
Resets a query before search. This needs to be called if the same query is used multiple times for different searches (e.g. only modifying search terms values)


toString

public String toString()

Overrides:
toString in class Object

validate

public void validate()
              throws Exception
Validates this query, throws any error exception if query is not valid

Throws:
Exception

isDoNotShowAcceptedByOthers

public boolean isDoNotShowAcceptedByOthers()
Whether query should display tasks accepted by other principals


setDoNotShowAcceptedByOthers

public void setDoNotShowAcceptedByOthers(boolean doNotShow)
Whether query should display tasks accepted by other principals


getInvocationID

public long getInvocationID()
Returns:
ID of the search invocation.

setInvocationID

public void setInvocationID(long m_invocationid)
Set the ID of the search invocation.

Parameters:
m_invocationid -