com.filenet.api.admin

Interface CmIndexDefinition

  • All Superinterfaces:
    DependentObject, EngineObject, RepositoryObject, java.io.Serializable


    public interface CmIndexDefinition
    extends RepositoryObject, EngineObject, DependentObject
    Defines a database table's index.

    Using the properties on this class, you can:

    • Control which tablespace/filegroup contains the index.
    • Specify the order of the columns in the index.
    • Specify that an index is unique.
    • Indicate whether the index is case-insensitive or not (on supporting configurations).

    Note that these properties are all SETTABLE_ONLY_ON_CREATE. Therefore, instances of CmIndexDefinition are immutable once created. To change an index, you must delete the existing CmIndexDefinition instance (which results in the index being dropped from the database), and then create a new instance with the required changes.

    If you create a CmIndexDefinition object for a manually created index (an index that a database administrator created using the native database tools), the name specified for the CmIndexDefinition object must be the same as the name for the manually created index. The server will detect that the physical index already exists and, in such cases, will update only the metadata in the tables (skipping the actual index creation but performing the index definition creation).

    The following code creates a unique index on the columns representing the two properties cr1s, cr5s of the myCustomClass class. The columns appear in the index in the same order as the properties appear in the class definition.

     // Get TableDefinition to add compound index.
     ClassDefinition classDef= Factory.ClassDefinition.fetchInstance(os, "myCustomClass", null);
     TableDefinition td = classDef.get_TableDefinition();
     // Create CmIndexedColumnList for columns to be indexed.
     CmIndexedColumnList indCols = Factory.CmIndexedColumn.createList();
     
     // Get PropertyDefinitions for class.
     PropertyDefinitionList propDefs = classDef.get_PropertyDefinitions();
     
     // Iterate PropertiesDefinitionList in search of properties 
     // that correspond with the two columns to be indexed.
     Iterator iter = propDefs.iterator();
     while (iter.hasNext()) 
     {
         PropertyDefinition propDef = (PropertyDefinition) iter.next();
         if (propDef.get_SymbolicName().equals("cr1s") 
             || propDef.get_SymbolicName().equals("cr5s"))
         {
             // Iterate column definitions to add target columns to list.
             ColumnDefinitionList colDefs = td.get_ColumnDefinitions();
             Iterator iter2 = colDefs.iterator();
             while (iter2.hasNext()) 
             {
                 ColumnDefinition colDef = (ColumnDefinition) iter2.next();
                 if (propDef.get_ColumnId().equals(colDef.get_Id()))
                 {
                     CmIndexedColumn indCol = Factory.CmIndexedColumn.createInstance();  
                     indCol.set_ColumnName(colDef.get_ColumnName());
                     SortOrder sortValue = propName.equals("cr1s") ? SortOrder.ASCENDING 
                                           : SortOrder.DESCENDING;
                    indCol.set_SortOrder(sortValue);
                    indCols.add(indCol);
                    break;
                 }
             }
         } 
     }
    
     // Create CmIndexDefinition and set columns to be indexed and other properties.
     CmIndexDefinitionList indDefs = td.get_IndexDefinitions();
     CmIndexDefinition indDef = Factory.CmIndexDefinition.createInstance();
     indDef.set_RequiresUniqueElements(java.lang.Boolean.TRUE);
     indDef.set_ForCaseInsensitiveSearch(java.lang.Boolean.FALSE);
     indDef.set_IndexedColumns(indCols);    
     indDefs.add(indDef);
     
     // Set index definition on table and save.
     td.set_IndexDefinitions(indDefs);
     td.save(RefreshMode.NO_REFRESH);

    Metadata

    • Method Detail

      • get_Id

        Id get_Id()
        Returns the value of the Id property. For more information, see Id Property.
      • get_IsSystemOwned

        java.lang.Boolean get_IsSystemOwned()
        Returns the value of the IsSystemOwned property. For more information, see IsSystemOwned Property.
      • get_IndexName

        java.lang.String get_IndexName()
        Returns the value of the IndexName property. For more information, see IndexName Property.
      • set_IndexName

        void set_IndexName(java.lang.String value)
        Sets the value of the IndexName property. For more information, see IndexName Property.
      • get_DatabaseIndexStorageLocation

        java.lang.String get_DatabaseIndexStorageLocation()
        Returns the value of the DatabaseIndexStorageLocation property. For more information, see DatabaseIndexStorageLocation Property.
      • set_DatabaseIndexStorageLocation

        void set_DatabaseIndexStorageLocation(java.lang.String value)
        Sets the value of the DatabaseIndexStorageLocation property. For more information, see DatabaseIndexStorageLocation Property.
      • get_RequiresUniqueElements

        java.lang.Boolean get_RequiresUniqueElements()
        Returns the value of the RequiresUniqueElements property. For more information, see RequiresUniqueElements Property.
      • set_RequiresUniqueElements

        void set_RequiresUniqueElements(java.lang.Boolean value)
        Sets the value of the RequiresUniqueElements property. For more information, see RequiresUniqueElements Property.
      • get_ForCaseInsensitiveSearch

        java.lang.Boolean get_ForCaseInsensitiveSearch()
        Returns the value of the ForCaseInsensitiveSearch property. For more information, see ForCaseInsensitiveSearch Property.
      • set_ForCaseInsensitiveSearch

        void set_ForCaseInsensitiveSearch(java.lang.Boolean value)
        Sets the value of the ForCaseInsensitiveSearch property. For more information, see ForCaseInsensitiveSearch Property.

© Copyright IBM Corporation 2006, 2015. All rights reserved.