com.filenet.rm.api

Interface RMPagedSearch



  • public interface RMPagedSearch
    Provides functionality for performing single object type searches of Records Manager objects. You can use the RMPagedSearch class to perform ad hoc searches that fulfill specific one-time requirements to retrieve information from an object store.

    You can use the methods defined for this class to search for record categories, record folders, records, and physical record markers. These methods return paged results.

    To execute a single object type search and return paged results, perform the following steps:

    1. Obtain an RMPagedSearch object by calling the getRMPagedSearch method on the RMObjectStore object that represents the object store to be searched.
    2. Call the singleObjectTypeExecute(String, String, String, String, int, int, boolean) method to execute the search and return the paged result.
    3. To page through the result set, call either the nextPageXML() method or the previousPageXML() method to page through the result. Call the hasNextPage() method to see if you have reached the end of the result set or the hasPreviousPage() method to see if you have reached the beginning of the result set.

    The following code sample illustrates using the RMPagedSearch class:

    RMPagedSearch pagedSearch = objStore.getRMPagedSearch();

    String stmt = "Select d.DocumentTitle, d.ClassDescription from Document d Where d.Creator='jdoe'";
    String asNonPropSQLstmt = null;
    String asContentSearchWhereClause = "(contains(content, '(testCBR)'))";
    String asOperator = "AND";
    int pageSize = 50; // set to return 50 documents each page call.
    boolean filterByParent=false;
    pagedSearch.singleObjectTypeExecute(stmt,asNonPropSQLstmt, asContentSearchWhereClause, asOperator, BaseObject.TYPE_DOCUMENT, pageSize, filterByParent);

    while (pagedSearch.hasNextPage())
    {
       String objectsetXML = pagedSearch.nextPageXML();
       system.out.println(objectsetXML);
    }

    Note: For a query that combines a property and content search with the AND operator and sorts by a property, a subsequent call of nextPage() or nextPageXML() may return empty results, even though hasNextPage() returns true. If this happens, it is an indication that the search has reached the end of the result set. The following code sample illustrates this behavior:

    RMPagedSearch pagedSearch = objStore.getRMPagedSearch();

    String stmt = "Select d.DocumentTitle, d.ClassDescription from Document d Where d.Creator='jdoe' order by d.DocumentTitle";
    String asNonPropSQLstmt = null;
    String asContentSearchWhereClause = "(contains(content, '(testCBR)'))";
    String asOperator = "AND";
    int pageSize = 50; // set to return 50 documents each page call.
    boolean filterByParent=false;
    pagedSearch.singleObjectTypeExecute(stmt,asNonPropSQLstmt, asContentSearchWhereClause, asOperator, BaseObject.TYPE_DOCUMENT, pageSize, filterByParent);

    while (pagedSearch.hasNextPage())
    {
       Object[] rowset = pagedSearch.nextPage();
       if (rowset == null || rowset.size() == 0)
       {
          // The end of paging. No more search results.
          break;
       }
       else
       {
          //Process rowset ...
       }
    }

    • Method Detail

      • singleObjectTypeExecute

        void singleObjectTypeExecute(java.lang.String asSearchSQLstmt,
                                   java.lang.String asNonPropSQLstmt,
                                   java.lang.String asContentSearchWhereClause,
                                   java.lang.String asOperator,
                                   int aiObjectType,
                                   int pageSize,
                                   boolean filterByParent)
        Searches for objects of a specified type by property values and returns paged results.

        The singleObjectTypeExecute() method supports two P8 object types: BaseObject.TYPE_DOCUMENT and BaseObject.TYPE_FOLDER. Currently, this method does not support content-based retrieval on Document type.

        With one exception, this method does not support table joins when performing the search. If the SELECT statement contains an illegal join such as a multi-table join or a self-join, the returned result is undefined.

        When you call this method, you must pass in an SQL statement that contains the ClassDescription property in its select list. For example, you might define the select list as follows:

        Select d.DocumentTitle, d.DateCreated, d.ClassDescription From Document d

        The singleObjectTypeExecute() method returns a rowset of the search results. To get paged results, call the nextPageXML() or the previousPageXML() method.

        Parameters:
        asSearchSQLstmt - A String defining the criteria for searching metadata in a FPOS using an SQL statement.
        asNonPropSQLstmt - A String defining the non property SQL statement like specifying the file plan or class, this is only needed when parameter asOperator is "OR". In "AND" conditions, set this value to null.
        asContentSearchWhereClause - A String that defines the WHERE clause for a content-based search in the ROS. For a metadata search, this parameter needs to be null.
        asOperator - A String logic operator specifying either the moOR_OPERATOR or moAND_OPERATOR operator, to indicate the merge option for the metadata or content search on the FPOS and the content search on the ROS.
        aiObjectType - An int value identifying the type of object to be searched. The object type must be either BaseObject.TYPE_DOCUMENT or BaseObject.TYPE_FOLDER.
        pageSize - A positive int value identifying the page size of the returned pages.
        filterByParent - A boolean value specifying if the query contains the "filter by parent" clause and should only be used in the asSearchSQLstmt parameter. True indicates that the query contains the clause.
      • nextPageXML

        java.lang.String nextPageXML()
        Returns a String containing the current page of the search results that were obtained by a call to the singleObjectTypeExecute(String, String, String, String, int, int, boolean) method and repositions the iterator to the next page.

        Call the hasNextPage() method to determine if there is a next page in the result set.

        Returns:
        A String containing the current page of the result set in XML format. The XML format is based on the Search XML Schema that is provided by the Content Engine Java API.
      • previousPageXML

        java.lang.String previousPageXML()
        Returns a String containing the current page of the search results that were obtained by a call to the singleObjectTypeExecute(String, String, String, String, int, int, boolean) method and repositions the iterator to the previous page.

        Call the hasPreviousPage() method to determine if there is a previous page in the result set.

        Returns:
        A String containing the current page of the result set in XML format. The XML format is based on the Search XML Schema that is provided by the Content Engine Java API.
      • nextPage

        java.lang.Object[] nextPage()
        Returns an array containing each repository row in the current page of the search results that were obtained by a call to the singleObjectTypeExecute(String, String, String, String, int, int, boolean) method and repositions the iterator to the next page.

        Call the hasNextPage() method to determine if there is a next page in the result set.

        Returns:
        An Object array containing the repository rows in the current page of the search results.
      • previousPage

        java.lang.Object[] previousPage()
        Returns an array containing each repository row in the current page of the search results that were obtained by a call to the singleObjectTypeExecute(String, String, String, String, int, int, boolean) method and repositions the iterator to the previous page.

        Call the hasPreviousPage() method to determine if there is a previous page in the result set.

        Returns:
        An Object array containing the repository rows in the current page of the search results.
      • executeXML

        java.lang.String executeXML(java.lang.String asSearchRequestXML,
                                  java.lang.String asContentSearchRequestXML,
                                  java.lang.String asOperator)
        Searches across one or more object stores by property values, by content, or both, and returns an XML String that contains a representation of the Record Manager objects meeting the search criteria.

        The asSearchRequestXML and asContentSearchWhereClause parameters define the search criteria and scope as follows:

        asSearchRequestXML asContentSearchRequestXML Searches
        Contains a WHERE clause null or empty The metadata in a File Plan Object Store (FPOS).
        Contains a WHERE clause Contains a WHERE clause. The content in a Records Object Store (ROS).
        Contains object ID and aggregation properties Contains a WHERE clause The metadata in an FPOS and the content in an ROS.

        The method merges the results obtained from the FPOS and ROS based on the values provided in the asOperator parameter. You must specify this parameter if this method is to return both metadata and content.

        Parameters:
        asSearchRequestXML - A String in XML format. If the method is to search the metadata in the FPOS, this String defines the search criteria. If the method is to search the content only, this String contains the ID and aggregation properties that identify the objects to be searched. This parameter cannot be null.
        asContentSearchRequestXML - A String in XML format that defines the WHERE clause for searching content in a ROS. Set this parameter to null if the method is to search only the metadata.
        asOperator - A String specifying either the moOR_OPERATOR or moAND_OPERATOR operator to indicate the merge option for the metadata or content search on the FPOS and the content search on the ROS.
        Returns:
        A String in XML format that contains a representation of the objects that meet the search criteria. This String is in XML format based on the Search XML Schema provided by the Microsoft ADO RecordSet object.

© Copyright IBM Corp. 2003, 2013. All Rights Reserved.