Package com.sas.services.information
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
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 Summary
FieldsFields inherited from interface com.sas.services.information.FilterInterface
BASE_SCOPE, FILTERCOMPONENT_UNSUPPORTED, FLAG_OVERRIDE, ONELEVEL_SCOPE, PROTOCOL_DAV, PROTOCOL_HIBERNATE, PROTOCOL_IPOD, PROTOCOL_LDAP, PROTOCOL_OMI, SUBTREE_SCOPE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddProtocol(String protocol) Add a protocol string to the list to be searched (e.g., "omi", "dav").voidaddSearchOption(String name, Object option) Add a search option.protected Stringcomponent2JCRXPath(FilterComponent component) protected Stringcomponent2Select(FilterComponent component) For 9.3, this method is used for backwards compatibility only.StringGet the DAV search base.StringGet the filter in the form of a DAV basicsearch XML request.intGet the scope of the search for DAV searches.StringGet the filter in the form of a DAV SQL request.StringGet the DAV type string.StringGet the explicit search string set by the client.Get the FilterComponent for this filter.StringGet the filter in a generic string form.StringGet the type string.StringGet an XPath string to use to filter a search against a Java Content Repository.StringgetName()Get the name of the object to look for.intGet the flags to add to the OMI request.StringGet the OMR option string.StringGet the string representing the OMR repository name or ID to perform the search in.StringReturns the OMR specific search string for this filter.StringGet a template string used to format the data coming back from OMR.StringGet the OMR type.ListGet the List of protocols that were set to be searched.StringGet the relational database table to search.MapGet the Map of search options for this Filter.StringgetType()Get the type of object to search for.StringGet the filter in the form of an XMLSelect statement.StringDeprecated.in favor of getXMLSelect().voidremoveProtocol(String protocol) Remove a protocol from the list.voidremoveSearchOption(String name) Remove the named search option.voidsetDAVBase(String base) Set the DAV search base.voidsetDAVScope(int scope) Set the DAV search scope.voidsetExplicitSearchString(String protocol, String searchString) If the client knows exactly the search string they want to use, they may set it here.voidsetFilterComponent(FilterComponent component) Set the component to use with this filter.voidsetName(String name) Set the name of the object to search for.voidsetOMRFlags(int flags) Set flags on the OMI request sent to the OMR server.voidsetOMROption(String option) Set the OMR option string.voidsetOMRRepository(String reposid) Set the repository name or ID to perform the search in.voidsetOMRTemplate(String template) Set the OMR template.voidsetProtocols(List protocols) Set the list of protocols to search.voidsetRdbmsTable(String table) For Relational searches, set the table name to search.voidsetType(String type) Set the type to search for.StringtoString()Get a string representation of the filter suitable for output.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Field Details
-
_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:
getFilterStringin interfaceFilterInterface- Returns:
- A string representation of the filter.
-
toString
public String toString()Get a string representation of the filter suitable for output.- Overrides:
toStringin classObject- Returns:
- A string representation of the filter.
-
setFilterComponent
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:
setFilterComponentin interfaceFilterInterface- Parameters:
component- The new component to add to this filter.
-
getFilterComponent
Description copied from interface:FilterInterfaceGet the FilterComponent for this filter.- Specified by:
getFilterComponentin interfaceFilterInterface- Returns:
- The FilterComponent.
-
setType
public void setType(String type) Set the type to search for.- Specified by:
setTypein interfaceFilterInterface- Parameters:
type- The object type to search for.
-
getType
public String getType()Get the type of object to search for.- Specified by:
getTypein interfaceFilterInterface- 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:
getOMRTypein interfaceFilterInterface- 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:
getDAVTypein interfaceFilterInterface- 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:
setNamein interfaceFilterInterface- Parameters:
name- The object name.
-
getName
public String getName()Get the name of the object to look for.- Specified by:
getNamein interfaceFilterInterface- 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:
getOMRSearchStringin interfaceFilterInterface- 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:
getXMLSelectStringin interfaceFilterInterface- Returns:
- An XMLSelect string to pass to OMR.
-
component2Select
For 9.3, this method is used for backwards compatibility only. Ideally, subclasses should not override this method. -
component2JCRXPath
-
getXPathString
public String getXPathString()Deprecated.in favor of getXMLSelect().Get an XPath string to use to filter a search against OMR.- Specified by:
getXPathStringin interfaceFilterInterface- 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:
getJCRXPathStringin interfaceFilterInterface- 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:
getOMRTemplatein interfaceFilterInterface- 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:
setOMRTemplatein interfaceFilterInterface- 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:
getOMROptionin interfaceFilterInterface- Returns:
- An option string to pass to OMR.
-
setOMROption
public void setOMROption(String option) Set the OMR option string.- Specified by:
setOMROptionin interfaceFilterInterface- 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:
setOMRFlagsin interfaceFilterInterface- 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:
getOMRFlagsin interfaceFilterInterface- 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:
getOMRRepositoryin interfaceFilterInterface- 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:
setOMRRepositoryin interfaceFilterInterface- Parameters:
reposid- The repository name or ID to search.
-
getDAVBase
public String getDAVBase()Get the DAV search base.- Specified by:
getDAVBasein interfaceFilterInterface- 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:
setDAVBasein interfaceFilterInterface- Parameters:
base- The search base for searches represented by this filter.
-
setRdbmsTable
public void setRdbmsTable(String table) Description copied from interface:FilterInterfaceFor Relational searches, set the table name to search.- Specified by:
setRdbmsTablein interfaceFilterInterface- Parameters:
table- The relational table to search for objects.
-
getRdbmsTable
public String getRdbmsTable()Description copied from interface:FilterInterfaceGet the relational database table to search.- Specified by:
getRdbmsTablein interfaceFilterInterface- Returns:
- The relational table String.
-
setDAVScope
public void setDAVScope(int scope) Set the DAV search scope.- Specified by:
setDAVScopein interfaceFilterInterface- Parameters:
scope- The new scope of the search.
-
getDAVScope
public int getDAVScope()Get the scope of the search for DAV searches.- Specified by:
getDAVScopein interfaceFilterInterface- 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:
getDAVBasicSearchStringin interfaceFilterInterface- 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:
getDAVSQLStringin interfaceFilterInterface- Returns:
- An XML DAV SQL request to pass to a DAV server.
-
addProtocol
public void addProtocol(String protocol) Description copied from interface:FilterInterfaceAdd 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:
addProtocolin interfaceFilterInterface- Parameters:
protocol- A protocol string to control the types of repositories to search.
-
removeProtocol
public void removeProtocol(String protocol) Description copied from interface:FilterInterfaceRemove a protocol from the list.- Specified by:
removeProtocolin interfaceFilterInterface- Parameters:
protocol- The protocol string to remove.
-
setProtocols
public void setProtocols(List protocols) Description copied from interface:FilterInterfaceSet 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:
setProtocolsin interfaceFilterInterface- Parameters:
protocols- A List of protocol Strings (e.g., "omi", "dav").
-
getProtocols
public List getProtocols()Description copied from interface:FilterInterfaceGet the List of protocols that were set to be searched.- Specified by:
getProtocolsin interfaceFilterInterface- Returns:
- A List of protocol Strings.
-
setExplicitSearchString
public void setExplicitSearchString(String protocol, String searchString) Description copied from interface:FilterInterfaceIf 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:
setExplicitSearchStringin interfaceFilterInterface- 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:FilterInterfaceGet the explicit search string set by the client. This overrides the filter components.- Specified by:
getExplicitSearchStringin interfaceFilterInterface- Returns:
- The search String to use.
-
addSearchOption
public void addSearchOption(String name, Object option) Description copied from interface:FilterInterfaceAdd 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:
addSearchOptionin interfaceFilterInterface- 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:FilterInterfaceRemove the named search option.- Specified by:
removeSearchOptionin interfaceFilterInterface- Parameters:
name- The name of the option to remove.
-
getSearchOptions
public Map getSearchOptions()Description copied from interface:FilterInterfaceGet the Map of search options for this Filter.- Specified by:
getSearchOptionsin interfaceFilterInterface- Returns:
- The search options Map.
-