com.ibm.jarm.api.query

Class RMContentSearchDefinition

  • java.lang.Object
    • com.ibm.jarm.api.query.RMContentSearchDefinition
  • All Implemented Interfaces:
    java.lang.Cloneable


    public abstract class RMContentSearchDefinition
    extends java.lang.Object
    implements java.lang.Cloneable
    Abstract class RMContentSearchDefinition defines the content-based retrieval query, such as query conditions for both CBR and metadata, the results to return, the sort order and so on. Specific concrete CBR-related search implementations extend this class. An instance of the appropriate concrete subclass is passed to the RMSearch.contentBasedRetrieval method to conduct the CBR search. This class defines the following fields:
    1. select clause: a SELECT clause in standard SQL statement, such as "SELECT d.Id, d.RMEntityType, d.DocumentTitle, d.ClassDescription, d.Creator".
    2. from clause: a FROM clause in standard SQL statement, such as "FROM ElectronicRecordInfo d". It also contains joins between record classes, such as "FROM (RMFolder f INNER JOIN ReferentialContainmentRelationship r ON f.This=r.Tail) INNER JOIN RecordInfo d ON d.This=r.Head".
    3. where clause: a WHERE clause in standard SQL statement that defines metadata search criteria only, such as "WHERE ((((f.this INSUBFOLDER '/Records Management/File Plan') OR (f.this=Object('/Records Management/File Plan'))) AND (d.VersionStatus = 1) AND d.isDeleted = false) AND ((d.DocumentTitle LIKE '%documentTitleString%')))".
    4. content Search: CBR keyword(s). It can be a single keyword, say "IBM". It can also be a valid CBR clause such as "red AND green" which is to search for the documents containing both "red" and "green".
    5. order by: either OrderBy.metadata to indicate the search results are ordered by a metadata property such as DocumentTitle, or OrderBy.cbrscores to indicate the search results are ordered by CBR scores.
    6. sort order: either SortOrder.asc for the ascending order or SortOrder.desc for descending or SortOrder.none for no ordering.
    7. order clause: an ORDER BY clause in standard SQL statement, such as "ORDER BY d.DocumentTitle", when OrderBy.metadata is specified in the order by field. If OrderBy.cbrscores is specified, this field is ignored.
    8. operator between Content and Metadata Search: an operator to apply between the CBR search and metadata search, either AndOrOper.and or AndOrOper.or.
    9. SQL alias of record class: alias of the record info class in the FROM clause. For example, "FROM RecordInfo d", then this field is "d".
    The following fields only apply to the case where operBtwContentAndMetadataSearch is set to AndOrOper.or and orderBy set to OrderBy.metadata. In other cases, this field is ignored.
    1. where clause for common criteria: This field specifies three general criteria for metadata search, a. inside the FilePlan folder, b. VersionStatus is 1 (Released), c. isDeleted is false. such as "WHERE ( ((f.this INSUBFOLDER '/Records Management/File Plan') OR (f.this=Object('/Records Management/File Plan'))) AND (d.VersionStatus = 1) AND (d.isDeleted = false) )"
    2. is CBR Condition Only: This field specifies whether or not there are other metadata criteria besides the three general criteria for metadata search, true if there is no other metadata criteria, which means this is a CBR condition only; otherwise false.
    • Constructor Detail

      • RMContentSearchDefinition

        public RMContentSearchDefinition()
        Default constructor
      • RMContentSearchDefinition

        public RMContentSearchDefinition(java.lang.String selectClause,
                                 java.lang.String fromClause,
                                 java.lang.String whereClause,
                                 java.lang.String orderClause,
                                 java.lang.String sqlAlias,
                                 java.lang.String content,
                                 RMContentSearchDefinition.SortOrder sortOrder,
                                 RMContentSearchDefinition.OrderBy orderBy,
                                 boolean cbrConditionOnly)
        Constructs a new instance.
        Parameters:
        selectClause - a String of select clause.
        fromClause - a String of from clause.
        whereClause - a String of where clause.
        orderClause - a String of order clause.
        sqlAlias - a String to specify the SQL alias of record class.
        content - a String of content search keyword(s).
        sortOrder - a RMContentSearchDefinition.SortOrder value to specify the sort order.
        orderBy - a RMContentSearchDefinition.OrderBy value to specify order by metadata, by CBR scores, or none.
        cbrConditionOnly - a boolean to specify where or not it is CBR condition only.
    • Method Detail

      • getCommonWhereClause

        public java.lang.String getCommonWhereClause()
        Get the where clause for common criteria.
        Returns:
        A String of the where clause for common criteria.
      • setCommonWhereClause

        public void setCommonWhereClause(java.lang.String commonWhereClause)
        Set the where clause for common criteria.
        Parameters:
        commonWhereClause - a String of the where clause for common criteria.
      • createInstance

        public static RMContentSearchDefinition createInstance(RMDomain rmDomain)
        Create an instance of concrete class that extends this abstract class based on the specified RMDomain.
        Parameters:
        rmDomain - a RMDomain value.
        Returns:
        An instance of concrete class that extends this abstract class.
      • isCBRConditionOnly

        public boolean isCBRConditionOnly()
        Indicates if this content search definition contains CBR conditions only.
        Returns:
        true if it is a CBR condition only, otherwise false.
      • setCBRConditionOnly

        public void setCBRConditionOnly(boolean isCBRConditionOnly)
        Set a boolean to indicate this content search definition contains CBR conditions only.
        Parameters:
        isCBRConditionOnly - true if it is a CBR condition only, false otherwise.
      • getSelectClause

        public java.lang.String getSelectClause()
        Get the select clause.
        Returns:
        A String value.
      • setSelectClause

        public void setSelectClause(java.lang.String selectClause)
        Set the select clause.
        Parameters:
        selectClause - a String value.
      • getFromClause

        public java.lang.String getFromClause()
        Get the from clause.
        Returns:
        A String value.
      • setFromClause

        public void setFromClause(java.lang.String fromClause)
        Set the from clause.
        Parameters:
        fromClause - a String value.
      • getWhereClause

        public java.lang.String getWhereClause()
        Get the where clause.
        Returns:
        A String value.
      • setWhereClause

        public void setWhereClause(java.lang.String whereClause)
        Set the where clause.
        Parameters:
        whereClause - a String value.
      • getOrderClause

        public java.lang.String getOrderClause()
        Get the order clause.
        Returns:
        A String value.
      • setOrderClause

        public void setOrderClause(java.lang.String orderClause)
        Set the order clause.
        Parameters:
        orderClause - a String value.
      • getSqlAlias

        public java.lang.String getSqlAlias()
        Get the SQL alias of record class
        Returns:
        A String value.
      • setSqlAlias

        public void setSqlAlias(java.lang.String sqlAlias)
        Set the SQL alias of record class
        Parameters:
        sqlAlias - a String value.
      • getContentSearch

        public java.lang.String getContentSearch()
        Get content search keyword(s)
        Returns:
        A String value.
      • setContentSearch

        public void setContentSearch(java.lang.String contentSearch)
        Set content search keyword(s)
        Parameters:
        contentSearch - a String value.
      • buildSQLStmt

        public java.lang.String buildSQLStmt()
        Build the metadata search SQL statement based on the data in this search definition.
        Returns:
        A String of metadata search SQL statement.
      • buildSQLStmtFromCommonCriteria

        public java.lang.String buildSQLStmtFromCommonCriteria()
        Build the metadata search SQL statement using the where clause for common criteria. The where clause for common criteria only applies to the case where operBtwContentAndMetadataSearch is set to AndOrOper.or and orderBy is set to OrderBy.metadata.
        Returns:
        A String of metadata search SQL statement.
      • clone

        public java.lang.Object clone()
        This is to override the clone() method to clone another RMContentSearchDefinition object.
        Overrides:
        clone in class java.lang.Object
        Returns:
        A clone RMContentSearchDefinition object.
      • buildContentQueryStmt

        public abstract java.lang.String buildContentQueryStmt()
        Abstract method to build the CBR search SQL statement. Each Domain Type extends this class and implements the method.
        Returns:
        A String of CBR search SQL statement.
      • buildContentQueryStmt

        public abstract java.lang.String buildContentQueryStmt(java.util.List<java.lang.String> idList,
                                             boolean bRankSort)
        Abstract method to build the CBR search SQL statement to search for documents with the given document ID lists. Each Domain Type extends this class and implements the method.
        Parameters:
        idList - a List of String of document GUIDs.
        bRankSort - If true, the returned SQL statement contains "ORDER BY Rank". If false, the SQL does not contain "ORDER BY Rank". The performance is faster without "ORDER BY Rank".
        Returns:
        A String of CBR search SQL statement.
      • hasContentQueryDefined

        public abstract boolean hasContentQueryDefined()
        This method returns true if there is content Search keyword(s) presented.
        Returns:
        true to indicate there is a content Search defined.

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