org.dspace.browse
Class BrowseIndex

java.lang.Object
  extended by org.dspace.browse.BrowseIndex

public 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 Summary
 void generateMdBits()
          Populate the internal array containing the bits of metadata, for ease of use later
static BrowseIndex getBrowseIndex(SortOption so)
          Get the configured browse index that is defined to use this sort option
static BrowseIndex getBrowseIndex(String name)
          Get the browse index from configuration with the specified name.
static BrowseIndex[] getBrowseIndices()
          Get an array of all the browse indices for the current configuration
 String getDataType()
           
 String getDefaultOrder()
           
 String getDisplayType()
           
 String getDistinctTableName()
          Get the default name of the distinct table.
 String getIndexColumn()
          Get the name of the primary key index column
static BrowseIndex getItemBrowseIndex()
          Get the internally defined browse index for archived items
 String getMapTableName()
          Get the default name of the distinct map table.
 String[] getMdBits(int idx)
           
 String getMetadata()
           
 String getMetadata(int idx)
           
 int getMetadataCount()
           
 String getName()
           
 String getSequenceName(boolean isDistinct, boolean isMap)
          Get the name of the sequence that will be used in the given circumnstances
static String getSequenceName(int number, boolean isDistinct, boolean isMap)
          Get the name of the sequence that will be used in the given circumstances
 String getSortField(boolean isSecondLevel)
          Get the field for sorting associated with this index
 SortOption getSortOption()
          Get the SortOption associated with this index.
 String getTableName()
          Get the default index table name.
 String getTableName(boolean isCommunity, boolean isCollection)
          Deprecated. 1.5
 String getTableName(boolean isDistinct, boolean isCommunity, boolean isCollection)
          Deprecated. 1.5
 String getTableName(boolean isCommunity, boolean isCollection, boolean isDistinct, boolean isMap)
          Deprecated. 1.5
static String getTableName(int number, boolean isCommunity, boolean isCollection, boolean isDistinct, boolean isMap)
          Deprecated. 1.5
 String getValueColumn()
          Get the name of the colum that is used to store the default value column
static BrowseIndex getWithdrawnBrowseIndex()
          Get the internally defined browse index for withdrawn items
 String[] interpretField(String mfield, String init)
          Take a string representation of a metadata field, and return it as an array.
 boolean isAuthorityIndex()
          Is the browse index authority value?
 boolean isDate()
          Is the browse index type for a date?
 boolean isInternalIndex()
          Does this browse index represent one of the internal item indexes
static boolean isInternalIndex(BrowseIndex bi)
          Does the browse index represent one of the internal item indexes
 boolean isItemIndex()
          Is the browse index of display type full?
 boolean isMetadataIndex()
          Is the browse index of display type single?
static String[] tables()
          Deprecated.  
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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)
Returns:
Returns the mdBits.

getMetadata

public String getMetadata()
Returns:
Returns the metadata.

getMetadata

public String getMetadata(int idx)

getName

public String getName()
Returns:
Returns the name.

getSortOption

public SortOption getSortOption()
Get the SortOption associated with this index.


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 circumnstances

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 constrainted 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 constrainted 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 constrainted 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:

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:
isDistinct - is this a distinct table
isCommunity -
isCollection -
Returns:

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:

getDistinctTableName

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

Returns:

getValueColumn

public String getValueColumn()
Get the name of the colum 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

Returns:
Throws:
BrowseException

tables

public static String[] tables()
                       throws BrowseException
Deprecated. 

Returns:
Throws:
BrowseException

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

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

getBrowseIndex

public static BrowseIndex getBrowseIndex(SortOption so)
                                  throws BrowseException
Get the configured browse index that is defined to use this sort option

Parameters:
so -
Returns:
Throws:
BrowseException

getItemBrowseIndex

public static BrowseIndex getItemBrowseIndex()
Get the internally defined browse index for archived items

Returns:

getWithdrawnBrowseIndex

public static BrowseIndex getWithdrawnBrowseIndex()
Get the internally defined browse index for withdrawn items

Returns:

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

isInternalIndex

public static boolean isInternalIndex(BrowseIndex bi)
Does the browse index represent one of the internal item indexes

Parameters:
bi -
Returns:

isInternalIndex

public boolean isInternalIndex()
Does this browse index represent one of the internal item indexes

Returns:


Copyright © 2010 DuraSpace. All Rights Reserved.