Class BrowseIndex


  • public final class BrowseIndex
    extends Object
    This class holds all the information about a specifically configured BrowseIndex. It is responsible for parsing the configuration, understanding about what sort options are available, and what the names of the database tables that hold all the information are actually called.
    Author:
    Richard Jones
    • Method Detail

      • getDefaultOrder

        public String getDefaultOrder()
        Returns:
        Default order for this index, null if not specified
      • getDataType

        public String getDataType()
        Returns:
        Returns the datatype.
      • getDisplayType

        public String getDisplayType()
        Returns:
        Returns the displayType.
      • getMetadataCount

        public int getMetadataCount()
        Returns:
        Returns the number of metadata fields for this index
      • getMdBits

        public String[] getMdBits​(int idx)
        Parameters:
        idx - index
        Returns:
        Returns the mdBits.
      • getMetadata

        public String getMetadata()
        Returns:
        Returns the metadata.
      • getMetadata

        public String getMetadata​(int idx)
        Parameters:
        idx - index
        Returns:
        metadata
      • getName

        public String getName()
        Returns:
        Returns the name.
      • getSortOption

        public SortOption getSortOption()
        Get the SortOption associated with this index.
        Returns:
        SortOption
      • isDisplayFrequencies

        public boolean isDisplayFrequencies()
        Returns:
        true or false
      • generateMdBits

        public void generateMdBits()
        Populate the internal array containing the bits of metadata, for ease of use later
      • getSequenceName

        public String getSequenceName​(boolean isDistinct,
                                      boolean isMap)
        Get the name of the sequence that will be used in the given circumstances
        Parameters:
        isDistinct - is a distinct table
        isMap - is a map table
        Returns:
        the name of the sequence
      • getSequenceName

        public static String getSequenceName​(int number,
                                             boolean isDistinct,
                                             boolean isMap)
        Get the name of the sequence that will be used in the given circumstances
        Parameters:
        number - the index configuration number
        isDistinct - is a distinct table
        isMap - is a map table
        Returns:
        the name of the sequence
      • getTableName

        public static String getTableName​(int number,
                                          boolean isCommunity,
                                          boolean isCollection,
                                          boolean isDistinct,
                                          boolean isMap)
        Deprecated.
        1.5
        Get the name of the table for the given set of circumstances This is provided solely for cleaning the database, where you are trying to create table names that may not be reflected in the current index
        Parameters:
        number - the index configuration number
        isCommunity - whether this is a community constrained index (view)
        isCollection - whether this is a collection constrained index (view)
        isDistinct - whether this is a distinct table
        isMap - whether this is a distinct map table
        Returns:
        the name of the table
      • getTableName

        public String getTableName​(boolean isCommunity,
                                   boolean isCollection,
                                   boolean isDistinct,
                                   boolean isMap)
        Deprecated.
        1.5
        Get the name of the table in the given circumstances
        Parameters:
        isCommunity - whether this is a community constrained index (view)
        isCollection - whether this is a collection constrained index (view)
        isDistinct - whether this is a distinct table
        isMap - whether this is a distinct map table
        Returns:
        the name of the table
      • getTableName

        public String getTableName​(boolean isCommunity,
                                   boolean isCollection)
        Deprecated.
        1.5
        Get the name of the table in the given circumstances. This is the same as calling getTableName(isCommunity, isCollection, false, false);
        Parameters:
        isCommunity - whether this is a community constrained index (view)
        isCollection - whether this is a collection constrained index (view)
        Returns:
        the name of the table
      • getTableName

        public String getTableName()
        Get the default index table name. This is the same as calling getTableName(false, false, false, false);
        Returns:
        table name
      • getTableName

        public String getTableName​(boolean isDistinct,
                                   boolean isCommunity,
                                   boolean isCollection)
        Deprecated.
        1.5
        Get the table name for the given set of circumstances. This is the same as calling: getTableName(isCommunity, isCollection, isDistinct, false);
        Parameters:
        isCommunity - whether this is a community constrained index (view)
        isCollection - whether this is a collection constrained index (view)
        isDistinct - whether this is a distinct table
        Returns:
        table name
      • getMapTableName

        public String getMapTableName()
        Get the default name of the distinct map table. This is the same as calling getTableName(false, false, false, true);
        Returns:
        table name
      • getDistinctTableName

        public String getDistinctTableName()
        Get the default name of the distinct table. This is the same as calling getTableName(false, false, true, false);
        Returns:
        table name
      • getValueColumn

        public String getValueColumn()
        Get the name of the column that is used to store the default value column
        Returns:
        the name of the value column
      • getIndexColumn

        public String getIndexColumn()
        Get the name of the primary key index column
        Returns:
        the name of the primary key index column
      • isDate

        public boolean isDate()
        Is the browse index type for a date?
        Returns:
        true if date type, false if not
      • isMetadataIndex

        public boolean isMetadataIndex()
        Is the browse index of display type single?
        Returns:
        true if singe, false if not
      • isAuthorityIndex

        public boolean isAuthorityIndex()
        Is the browse index authority value?
        Returns:
        true if authority, false if not
      • isItemIndex

        public boolean isItemIndex()
        Is the browse index of display type full?
        Returns:
        true if full, false if not
      • getSortField

        public String getSortField​(boolean isSecondLevel)
                            throws BrowseException
        Get the field for sorting associated with this index.
        Parameters:
        isSecondLevel - whether second level browse
        Returns:
        sort field
        Throws:
        BrowseException - if browse error
      • getBrowseIndices

        public static BrowseIndex[] getBrowseIndices()
                                              throws BrowseException
        Get an array of all the browse indices for the current configuration
        Returns:
        an array of all the current browse indices
        Throws:
        BrowseException - if browse error
      • getBrowseIndex

        public static BrowseIndex getBrowseIndex​(String name)
                                          throws BrowseException
        Get the browse index from configuration with the specified name. The name is the first part of the browse configuration
        Parameters:
        name - the name to retrieve
        Returns:
        the specified browse index
        Throws:
        BrowseException - if browse error
      • getBrowseIndex

        public static BrowseIndex getBrowseIndex​(SortOption so)
                                          throws BrowseException
        Get the configured browse index that is defined to use this sort option.
        Parameters:
        so - sort option
        Returns:
        browse index
        Throws:
        BrowseException - if browse error
      • getItemBrowseIndex

        public static BrowseIndex getItemBrowseIndex()
        Get the internally defined browse index for archived items.
        Returns:
        browse index
      • getWithdrawnBrowseIndex

        public static BrowseIndex getWithdrawnBrowseIndex()
        Get the internally defined browse index for withdrawn items.
        Returns:
        browse index
      • getPrivateBrowseIndex

        public static BrowseIndex getPrivateBrowseIndex()
        Returns:
        browse index
      • interpretField

        public String[] interpretField​(String mfield,
                                       String init)
                                throws IOException
        Take a string representation of a metadata field, and return it as an array. This is just a convenient utility method to basically break the metadata representation up by its delimiter (.), and stick it in an array, inserting the value of the init parameter when there is no metadata field part.
        Parameters:
        mfield - the string representation of the metadata
        init - the default value of the array elements
        Returns:
        a three element array with schema, element and qualifier respectively
        Throws:
        IOException - if IO error
      • isInternalIndex

        public boolean isInternalIndex()
        Does this browse index represent one of the internal item indexes?
        Returns:
        true or false
      • isTagCloudEnabled

        public boolean isTagCloudEnabled()
        Is tag cloud enabled
        Returns:
        true or false