Class Filter

java.lang.Object
com.sas.services.information.Filter
All Implemented Interfaces:
FilterInterface, Serializable
Direct Known Subclasses:
AuthorFilter, ContentSubscriberFilter, EventSubscriberFilter, GuidFilter, HttpServerFilter, IdFilter, KeywordFilter, LogicalServerFilter, MessageQueueFilter, PathFilter, PersonFilter, PhysicalTableFilter, ServerFilter, SubscriberFilter

@SASScope("ALL") public class Filter extends Object implements FilterInterface, Serializable
The Filter class describes a means for setting and getting information used to limit the results of a search against a repository. While it would be nice to make it completely repository-neutral, there are concepts and mechanisms that just don't translate.

Since:
1.0
See Also:
  • Field Details

    • _component

      protected FilterComponent _component
      The component to filter on. Since components can contain components, this can still be a complex filter.
  • Constructor Details

    • Filter

      public Filter()
      Default Constructor. The basic filter has no components, type, or repository-specific information, and isn't a lot of use.
    • Filter

      public Filter(String key, int relation, String value)
      Construct a new Filter using the provided key, relation and value to create a component for this Filter. This is an easy way to construct a new simple filter in one operation.

      Parameters:
      key - The key to use for comparison.
      relation - The relationship between the key and value to test for. Usually FilterComponent.EQUALS.
      value - The value to test for.
  • Method Details

    • getFilterString

      public String getFilterString()
      Get the filter in a generic string form.

      Specified by:
      getFilterString in interface FilterInterface
      Returns:
      A string representation of the filter.
    • toString

      public String toString()
      Get a string representation of the filter suitable for output.

      Overrides:
      toString in class Object
      Returns:
      A string representation of the filter.
    • setFilterComponent

      public void setFilterComponent(FilterComponent component)
      Set the component to use with this filter. The filter component has the information describing what conditions entries should meet in order to be returned. Components can be joined to form complex queries.

      Specified by:
      setFilterComponent in interface FilterInterface
      Parameters:
      component - The new component to add to this filter.
    • getFilterComponent

      public FilterComponent getFilterComponent()
      Description copied from interface: FilterInterface
      Get the FilterComponent for this filter.
      Specified by:
      getFilterComponent in interface FilterInterface
      Returns:
      The FilterComponent.
    • setType

      public void setType(String type)
      Set the type to search for.

      Specified by:
      setType in interface FilterInterface
      Parameters:
      type - The object type to search for.
    • getType

      public String getType()
      Get the type of object to search for.

      Specified by:
      getType in interface FilterInterface
      Returns:
      The object type to search for.
    • getOMRType

      public String getOMRType()
      Get the OMR type. Return the type by default. subclasses may override this to return a different string. This method is mostly for use by the OMIRepository class.

      Specified by:
      getOMRType in interface FilterInterface
      Returns:
      The OMR specific type to search for.
    • getDAVType

      public String getDAVType()
      Get the DAV type string. Return the type by default. Subclasses may override this to return a different string. This method is for use by the DAVRepository class.

      Specified by:
      getDAVType in interface FilterInterface
      Returns:
      the DAV specific type to search for.
    • getJCRType

      public String getJCRType()
      Get the type string. Return the type by default. Subclasses may override this to return a different string. This method is for use by the JCRRepository class.

      Returns:
      the JCR specific type to search for.
    • setName

      public void setName(String name)
      Set the name of the object to search for.

      Specified by:
      setName in interface FilterInterface
      Parameters:
      name - The object name.
    • getName

      public String getName()
      Get the name of the object to look for.

      Specified by:
      getName in interface FilterInterface
      Returns:
      The object name.
    • getOMRSearchString

      public String getOMRSearchString()
      Returns the OMR specific search string for this filter. This string is identical to the the xml select statement, just minus the XMLSelect begin and end tags. This allows the search string to be plugged into either an xml select string or a template search.
      Specified by:
      getOMRSearchString in interface FilterInterface
      Returns:
      a search string to be used within an xml select statement or template search
    • getXMLSelectString

      public String getXMLSelectString()
      Get the filter in the form of an XMLSelect statement.

      Specified by:
      getXMLSelectString in interface FilterInterface
      Returns:
      An XMLSelect string to pass to OMR.
    • component2Select

      protected String component2Select(FilterComponent component)
      For 9.3, this method is used for backwards compatibility only. Ideally, subclasses should not override this method.
    • component2JCRXPath

      protected String component2JCRXPath(FilterComponent component)
    • getXPathString

      public String getXPathString()
      Deprecated.
      in favor of getXMLSelect().
      Get an XPath string to use to filter a search against OMR.

      Specified by:
      getXPathString in interface FilterInterface
      Returns:
      An XPath selection string.
    • getJCRXPathString

      public String getJCRXPathString()
      Get an XPath string to use to filter a search against a Java Content Repository.
      Specified by:
      getJCRXPathString in interface FilterInterface
      Returns:
      A JSR170 XPath selection string.
    • getOMRTemplate

      public String getOMRTemplate()
      Get a template string used to format the data coming back from OMR. This can be overridden by subclasses to return a template that may help filter results using the search mechanism in the templates.

      Specified by:
      getOMRTemplate in interface FilterInterface
      Returns:
      A data template to pass to OMR.
    • setOMRTemplate

      public void setOMRTemplate(String template)
      Set the OMR template. The template should be of the form
         
           
           
         
       
      The template will be passed to the metadata server and can control the total set of associated objects that will be returned from the query.

      Specified by:
      setOMRTemplate in interface FilterInterface
      Parameters:
      template - The template to pass to OMR to format results.
    • getOMROption

      public String getOMROption()
      Get the OMR option string. This isn't likely to be used for now. The only options that OMR supports are the XMLSelect and templates, and they're set separately.

      Specified by:
      getOMROption in interface FilterInterface
      Returns:
      An option string to pass to OMR.
    • setOMROption

      public void setOMROption(String option)
      Set the OMR option string.

      Specified by:
      setOMROption in interface FilterInterface
      Parameters:
      option - The string to pass to OMR as options.
    • setOMRFlags

      public void setOMRFlags(int flags)
      Set flags on the OMI request sent to the OMR server. These flags are added to the flags that are normally used, they don't replace them.

      Specified by:
      setOMRFlags in interface FilterInterface
      Parameters:
      flags - The OMI flags to add to the normal search flags.
    • getOMRFlags

      public int getOMRFlags()
      Get the flags to add to the OMI request.

      Specified by:
      getOMRFlags in interface FilterInterface
      Returns:
      The OMI flags.
    • getOMRRepository

      public String getOMRRepository()
      Get the string representing the OMR repository name or ID to perform the search in. If this is left null, the default repository is used, if set.

      Specified by:
      getOMRRepository in interface FilterInterface
      Returns:
      The repository to search.
    • setOMRRepository

      public void setOMRRepository(String reposid)
      Set the repository name or ID to perform the search in. If this is left unset, the default repository set in the RepositoryInterface instance will be searched.

      This option is used by OMR repository instances to set the repository to search. It does not limit the search to that one repository, or even to OMR repositories. To perform a search against a single repository, get a handle to that repository through the UserContext, or use the repositiory grouping mechanism of the Information Service.

      Specified by:
      setOMRRepository in interface FilterInterface
      Parameters:
      reposid - The repository name or ID to search.
    • getDAVBase

      public String getDAVBase()
      Get the DAV search base.

      Specified by:
      getDAVBase in interface FilterInterface
      Returns:
      The search base to use for this search. If _DAVbase is null then return an empty string
    • setDAVBase

      public void setDAVBase(String base)
      Set the DAV search base.

      Specified by:
      setDAVBase in interface FilterInterface
      Parameters:
      base - The search base for searches represented by this filter.
    • setRdbmsTable

      public void setRdbmsTable(String table)
      Description copied from interface: FilterInterface
      For Relational searches, set the table name to search.
      Specified by:
      setRdbmsTable in interface FilterInterface
      Parameters:
      table - The relational table to search for objects.
    • getRdbmsTable

      public String getRdbmsTable()
      Description copied from interface: FilterInterface
      Get the relational database table to search.
      Specified by:
      getRdbmsTable in interface FilterInterface
      Returns:
      The relational table String.
    • setDAVScope

      public void setDAVScope(int scope)
      Set the DAV search scope.

      Specified by:
      setDAVScope in interface FilterInterface
      Parameters:
      scope - The new scope of the search.
    • getDAVScope

      public int getDAVScope()
      Get the scope of the search for DAV searches.

      Specified by:
      getDAVScope in interface FilterInterface
      Returns:
      The search scope.
    • getDAVBasicSearchString

      public String getDAVBasicSearchString()
      Get the filter in the form of a DAV basicsearch XML request. This is described in the WebDAV SEARCH proposal.

      Specified by:
      getDAVBasicSearchString in interface FilterInterface
      Returns:
      An XML basicsearch request to pass to a DAV server.
    • getDAVSQLString

      public String getDAVSQLString()
      Get the filter in the form of a DAV SQL request. This is aimed at the Microsoft servers - Internet Information Server, SharePoint Portal Server and Exchange server.

      Specified by:
      getDAVSQLString in interface FilterInterface
      Returns:
      An XML DAV SQL request to pass to a DAV server.
    • addProtocol

      public void addProtocol(String protocol)
      Description copied from interface: FilterInterface
      Add a protocol string to the list to be searched (e.g., "omi", "dav"). Repositories whose protocol is not in this list will not perform the search. If the protocol list is empty, it will be ignored.
      Specified by:
      addProtocol in interface FilterInterface
      Parameters:
      protocol - A protocol string to control the types of repositories to search.
    • removeProtocol

      public void removeProtocol(String protocol)
      Description copied from interface: FilterInterface
      Remove a protocol from the list.
      Specified by:
      removeProtocol in interface FilterInterface
      Parameters:
      protocol - The protocol string to remove.
    • setProtocols

      public void setProtocols(List protocols)
      Description copied from interface: FilterInterface
      Set the list of protocols to search. This list controls the types of repositories that will be searched. Repository instances whose protocol does not match any in the list will ignore the search request.
      Specified by:
      setProtocols in interface FilterInterface
      Parameters:
      protocols - A List of protocol Strings (e.g., "omi", "dav").
    • getProtocols

      public List getProtocols()
      Description copied from interface: FilterInterface
      Get the List of protocols that were set to be searched.
      Specified by:
      getProtocols in interface FilterInterface
      Returns:
      A List of protocol Strings.
    • setExplicitSearchString

      public void setExplicitSearchString(String protocol, String searchString)
      Description copied from interface: FilterInterface
      If the client knows exactly the search string they want to use, they may set it here. The FilterComponents will be ignored in favor of this string. Since search strings are specific to a given repository implementation, the protocol is required.
      Specified by:
      setExplicitSearchString in interface FilterInterface
      Parameters:
      protocol - The protocol for which the search string is to be used.
      searchString - The search string to be used for the search.
    • getExplicitSearchString

      public String getExplicitSearchString()
      Description copied from interface: FilterInterface
      Get the explicit search string set by the client. This overrides the filter components.
      Specified by:
      getExplicitSearchString in interface FilterInterface
      Returns:
      The search String to use.
    • addSearchOption

      public void addSearchOption(String name, Object option)
      Description copied from interface: FilterInterface
      Add a search option. Search options are generally protocol-specific, so details of what options are supported are described in the repository implementation documentation.
      Specified by:
      addSearchOption in interface FilterInterface
      Parameters:
      name - The name of the option to be added.
      option - The option value. This is usually a String, but may be other object types.
    • removeSearchOption

      public void removeSearchOption(String name)
      Description copied from interface: FilterInterface
      Remove the named search option.
      Specified by:
      removeSearchOption in interface FilterInterface
      Parameters:
      name - The name of the option to remove.
    • getSearchOptions

      public Map getSearchOptions()
      Description copied from interface: FilterInterface
      Get the Map of search options for this Filter.
      Specified by:
      getSearchOptions in interface FilterInterface
      Returns:
      The search options Map.