Class TaskSearchQuery

java.lang.Object
com.webmethods.portal.service.task.TaskSearchQuery
All Implemented Interfaces:
ITaskConstants, ITaskSearchQuery, ITaskSearchQueryExtended, Serializable
Direct Known Subclasses:
TaskSearchQuery, TaskSearchQueryV2

public class TaskSearchQuery extends Object implements ITaskSearchQueryExtended, Serializable
TaskSearchQuery is the concrete implementation of ITaskSearchQuery.
See Also:
  • Field Details

    • m_maxResults

      protected int m_maxResults
    • m_checkPermissions

      protected boolean m_checkPermissions
    • m_terms

      protected List<TaskSearchQueryTerm> m_terms
    • m_principalID

      protected String m_principalID
    • m_doNotShowAcceptedByOthers

      protected boolean m_doNotShowAcceptedByOthers
    • m_showNonActiveTasks

      protected boolean m_showNonActiveTasks
    • m_invocationID

      protected long m_invocationID
    • m_activeVoting

      protected boolean m_activeVoting
  • Constructor Details

    • 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 Details

    • 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.
      Specified by:
      getMaxResults in interface ITaskSearchQueryExtended
      Returns:
      the max results to be returned. Default to -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)
      Specified by:
      isShowNonActiveTasks in interface ITaskSearchQueryExtended
      Returns:
      flag to show non active tasks in the search result. 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
      Specified by:
      isCheckPermissions in interface ITaskSearchQueryExtended
      Returns:
      flag if current user permission should be checked for the task searches
    • 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
      Specified by:
      getTerms in interface ITaskSearchQueryExtended
      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.
      Specified by:
      findTerm in interface ITaskSearchQueryExtended
      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.
      Specified by:
      findTerm in interface ITaskSearchQueryExtended
      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
      Specified by:
      getPrincipalID in interface ITaskSearchQueryExtended
      Returns:
      the principal id 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 adds the newly created search term to this search query.
      Parameters:
      fields - search fields array to be used for this search term.

      See ITaskSearchQuery for the 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 a field as index name defined for this field
      operator - search operator. See ITaskSearchQuery for the list of available operators
      value - search value
      Returns:
      the newly created and added search term.
    • addQueryTerm

      public TaskSearchQueryTerm addQueryTerm(String[] fields, String operator, Object value, String tableName)
      Creates new search term using the parameters provided and adds the newly created search term to this search query.
      Parameters:
      fields - search fields array to be used for this search term.

      See ITaskSearchQuery for the 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 a field as index name defined for this field
      operator - search operator. See ITaskSearchQuery for the list of available operators
      value - search value
      tableName - name of the DB table in which the search will be done.

      See ITaskSearchQuery for the list of available table names.
      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.
      Specified by:
      matches in interface ITaskSearchQueryExtended
      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 - if any exception occurs during the operation execution
    • matches

      public boolean matches(Map contextMap, com.webmethods.caf.rules.IBindingExpressionEvaluator resolver) throws Exception
      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)
      Specified by:
      reset in interface ITaskSearchQueryExtended
    • 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
      Specified by:
      validate in interface ITaskSearchQueryExtended
      Throws:
      Exception - if the query is invalid
    • isDoNotShowAcceptedByOthers

      public boolean isDoNotShowAcceptedByOthers()
      Whether query should display tasks accepted by other principals
      Specified by:
      isDoNotShowAcceptedByOthers in interface ITaskSearchQueryExtended
      Returns:
      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()
      Specified by:
      getInvocationID in interface ITaskSearchQueryExtended
      Returns:
      ID of the search invocation.
    • setInvocationID

      public void setInvocationID(long m_invocationid)
      Set the ID of the search invocation.
      Parameters:
      m_invocationid -
    • getSearchEngineType

      public String getSearchEngineType()
      Specified by:
      getSearchEngineType in interface ITaskSearchQueryExtended
      Returns:
      the engine type, which will be referenced when a search is performed. More information can be found here IndexEngineType and here. Custom search engines can be defined as well.
    • setSearchEngineType

      public void setSearchEngineType(String searchProvider)
      Parameters:
      searchProvider -
    • isActiveVoting

      public boolean isActiveVoting()
      Specified by:
      isActiveVoting in interface ITaskSearchQueryExtended
      Returns:
      returns true if search must include active voting tasks only (with at least one vote)
    • setActiveVoting

      public void setActiveVoting(boolean m_activeVoting)
      Parameters:
      m_activeVoting -