Package org.dspace.browse
Class BrowseIndex
- java.lang.Object
-
- org.dspace.browse.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 Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidgenerateMdBits()Populate the internal array containing the bits of metadata, for ease of use laterstatic BrowseIndexgetBrowseIndex(String name)Get the browse index from configuration with the specified name.static BrowseIndexgetBrowseIndex(SortOption so)Get the configured browse index that is defined to use this sort option.static BrowseIndex[]getBrowseIndices()Get an array of all the browse indices for the current configurationStringgetDataType()StringgetDefaultOrder()StringgetDisplayType()StringgetDistinctTableName()Get the default name of the distinct table.StringgetIndexColumn()Get the name of the primary key index columnstatic BrowseIndexgetItemBrowseIndex()Get the internally defined browse index for archived items.StringgetMapTableName()Get the default name of the distinct map table.String[]getMdBits(int idx)StringgetMetadata()StringgetMetadata(int idx)intgetMetadataCount()StringgetName()static BrowseIndexgetPrivateBrowseIndex()StringgetSequenceName(boolean isDistinct, boolean isMap)Get the name of the sequence that will be used in the given circumstancesstatic StringgetSequenceName(int number, boolean isDistinct, boolean isMap)Get the name of the sequence that will be used in the given circumstancesStringgetSortField(boolean isSecondLevel)Get the field for sorting associated with this index.SortOptiongetSortOption()Get the SortOption associated with this index.StringgetTableName()Get the default index table name.StringgetTableName(boolean isCommunity, boolean isCollection)Deprecated.1.5StringgetTableName(boolean isDistinct, boolean isCommunity, boolean isCollection)Deprecated.1.5StringgetTableName(boolean isCommunity, boolean isCollection, boolean isDistinct, boolean isMap)Deprecated.1.5static StringgetTableName(int number, boolean isCommunity, boolean isCollection, boolean isDistinct, boolean isMap)Deprecated.1.5StringgetValueColumn()Get the name of the column that is used to store the default value columnstatic BrowseIndexgetWithdrawnBrowseIndex()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.booleanisAuthorityIndex()Is the browse index authority value?booleanisDate()Is the browse index type for a date?booleanisDisplayFrequencies()booleanisInternalIndex()Does this browse index represent one of the internal item indexes?booleanisItemIndex()Is the browse index of display type full?booleanisMetadataIndex()Is the browse index of display type single?booleanisTagCloudEnabled()Is tag cloud enabledstatic String[]tables()Deprecated.
-
-
-
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 tableisMap- 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 numberisDistinct- is a distinct tableisMap- is a map table- Returns:
- the name of the sequence
-
getTableName
@Deprecated public static String getTableName(int number, boolean isCommunity, boolean isCollection, boolean isDistinct, boolean isMap)
Deprecated.1.5Get 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 numberisCommunity- whether this is a community constrained index (view)isCollection- whether this is a collection constrained index (view)isDistinct- whether this is a distinct tableisMap- whether this is a distinct map table- Returns:
- the name of the table
-
getTableName
@Deprecated public String getTableName(boolean isCommunity, boolean isCollection, boolean isDistinct, boolean isMap)
Deprecated.1.5Get 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 tableisMap- whether this is a distinct map table- Returns:
- the name of the table
-
getTableName
@Deprecated public String getTableName(boolean isCommunity, boolean isCollection)
Deprecated.1.5Get the name of the table in the given circumstances. This is the same as callinggetTableName(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 callinggetTableName(false, false, false, false);- Returns:
- table name
-
getTableName
@Deprecated public String getTableName(boolean isDistinct, boolean isCommunity, boolean isCollection)
Deprecated.1.5Get 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 callinggetTableName(false, false, false, true);- Returns:
- table name
-
getDistinctTableName
public String getDistinctTableName()
Get the default name of the distinct table. This is the same as callinggetTableName(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
-
tables
@Deprecated public static String[] tables() throws BrowseException
Deprecated.- Returns:
- array of tables
- 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 metadatainit- 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
-
-