Package org.dspace.browse
Interface BrowseDAO
-
- All Known Implementing Classes:
SolrBrowseDAO
public interface BrowseDAOInterface for any class wishing to interact with the Browse storage layer for Read Only operations. If you wish to modify the contents of the browse indices or create and destroy index tables you should look at implementations for BrowseCreateDAO. If you implement this class, and you wish it to be loaded via the BrowseDAOFactory you must supply a constructor of the form: public BrowseDAOImpl(Context context) {} Where Context is the DSpace Context object Where tables are referred to in this class, they can be obtained from the BrowseIndex class, which will answer queries given the context of the request on which table is the relevant target.- Author:
- Richard Jones
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intdoCountQuery()This executes a query which will count the number of results for the parameters you set.intdoDistinctOffsetQuery(String column, String value, boolean isAscending)This executes a query which returns the offset where the value (or nearest greater equivalent) can be found in the specified table ordered by the column.StringdoMaxQuery(String column, String table, int itemID)This executes a query which returns the value of the "highest" (max) value in the given table's column for the given item id.intdoOffsetQuery(String column, String value, boolean isAscending)This executes a query which returns the offset where the value (or nearest greater equivalent) can be found in the specified table ordered by the column.List<Item>doQuery()This executes a query which returns a List object containing BrowseItem objects representing the results of a full item browse.List<String[]>doValueQuery()This executes a query which returns a List object containing String values which represent the results of a single value browse (for example, the list of all subject headings).StringgetAuthorityValue()DSpaceObjectgetContainer()Get the container object.StringgetContainerIDField()get the name of the field in which to look for the container id.StringgetContainerTable()Get the name of the container table that is being used to map items to distinct values when in a container constrained browseString[]getCountValues()Get the array of fields that we will be counting on.StringgetFilterValue()Get the value which we are constraining all our browse results to contain.StringgetFilterValueField()Get the name of the field in which the value to constrain results is containedStringgetJumpToField()Get the field in which we will match a focus value from which to start the browse.StringgetJumpToValue()Get the value at which the browse will start.intgetLimit()get the integer number which is the limit of the results that will be returned by any query.intgetOffset()Get the offset from the first result from which to return results.StringgetOrderField()Get the database field which will be used to do the sorting of result sets on.String[]getSelectValues()Get the array of values that we will be selecting on.StringgetStartsWith()StringgetTable()get the name of the table that we are queryingbooleanisAscending()Is the sort order ascending or descending? Default value is truebooleanisDistinct()Is this a distinct value browse?booleanisEnableBrowseFrequencies()voidsetAscending(boolean ascending)Set whether the results should be sorted in ascending order (on the given sort column) or descending order.voidsetAuthorityValue(String value)voidsetContainer(DSpaceObject container)Set the container object.voidsetContainerIDField(String containerIDField)set the name of the field in which to look for the container id.voidsetContainerTable(String containerTable)If we have specified a container id and container field, we must also specify a container table.voidsetCountValues(String[] fields)Set the array of columns that we will be counting over.voidsetDistinct(boolean bool)Set whether this is a distinct value browse or notvoidsetEnableBrowseFrequencies(boolean enableBrowseFrequencies)voidsetEqualsComparator(boolean equalsComparator)Set whether the query should use an equals comparator when doing less than or greater than comparisons.voidsetFilterMappingTables(String tableDis, String tableMap)Set the name of the mapping tables to use for filteringvoidsetFilterValue(String value)Set the value to which all our browse results should be constrained.voidsetFilterValueField(String valueField)Set the name of the field in which the value to constrain results is containedvoidsetFilterValuePartial(boolean part)Sets whether we will treat the filter value as partial (like match), or exactvoidsetJumpToField(String focusField)Set the focus field upon which we will match a value from which to start the browse.voidsetJumpToValue(String focusValue)Set the value upon which to start the browse from.voidsetLimit(int limit)Set the limit for how many results should be returned.voidsetOffset(int offset)Get the offset from the first result from which to return results.voidsetOrderField(String orderField)Set the database field which will be used to sort result sets onvoidsetSelectValues(String[] selectValues)Set the array of values to select on.voidsetStartsWith(String startsWith)voidsetTable(String table)Set the name of the table to querybooleanuseEqualsComparator()Does the query use the equals comparator when doing less than or greater than comparisons.
-
-
-
Method Detail
-
doCountQuery
int doCountQuery() throws BrowseExceptionThis executes a query which will count the number of results for the parameters you set.- Returns:
- the integer value of the number of results found
- Throws:
BrowseException- if browse error
-
doValueQuery
List<String[]> doValueQuery() throws BrowseException
This executes a query which returns a List object containing String values which represent the results of a single value browse (for example, the list of all subject headings). This is most commonly used with a Distinct browse type.- Returns:
- List of Strings representing the single value query results
- Throws:
BrowseException- if browse error
-
doQuery
List<Item> doQuery() throws BrowseException
This executes a query which returns a List object containing BrowseItem objects representing the results of a full item browse.- Returns:
- List of BrowseItem objects
- Throws:
BrowseException- if browse error
-
doMaxQuery
String doMaxQuery(String column, String table, int itemID) throws BrowseException
This executes a query which returns the value of the "highest" (max) value in the given table's column for the given item id.- Parameters:
column- the column to interrogatetable- the table to queryitemID- the item id- Returns:
- String representing the max value in the given column
- Throws:
BrowseException- if browse error
-
doOffsetQuery
int doOffsetQuery(String column, String value, boolean isAscending) throws BrowseException
This executes a query which returns the offset where the value (or nearest greater equivalent) can be found in the specified table ordered by the column.- Parameters:
column- the column to interrogatevalue- the item idisAscending- browsing in ascending or descending order- Returns:
- the offset into the table
- Throws:
BrowseException- if browse error
-
doDistinctOffsetQuery
int doDistinctOffsetQuery(String column, String value, boolean isAscending) throws BrowseException
This executes a query which returns the offset where the value (or nearest greater equivalent) can be found in the specified table ordered by the column.- Parameters:
column- the column to interrogatevalue- the item idisAscending- browsing in ascending or descending order- Returns:
- the offset into the table
- Throws:
BrowseException- if browse error
-
useEqualsComparator
boolean useEqualsComparator()
Does the query use the equals comparator when doing less than or greater than comparisons. @see setEqualsComparator Default value is true- Returns:
- true if using it, false if not
-
setEqualsComparator
void setEqualsComparator(boolean equalsComparator)
Set whether the query should use an equals comparator when doing less than or greater than comparisons. That is, if true then comparisons will be made using the equivalent of<=and>=, while if false it will use the equivalent of<and>- Parameters:
equalsComparator- true to use, false to not.
-
isAscending
boolean isAscending()
Is the sort order ascending or descending? Default value is true- Returns:
- true for ascending, false for descending
-
setAscending
void setAscending(boolean ascending)
Set whether the results should be sorted in ascending order (on the given sort column) or descending order.- Parameters:
ascending- true to ascend, false to descend
-
getContainer
DSpaceObject getContainer()
Get the container object. The container object will be a Community or a Collection.- Returns:
- the container, or null if none is set
-
setContainer
void setContainer(DSpaceObject container)
Set the container object. This should be a Community or Collection. This will constrain the results of the browse to only items or values within items that appear in the given container and add the related configuration default filters.- Parameters:
container- community/collection
-
getContainerIDField
String getContainerIDField()
get the name of the field in which to look for the container id. This is principally for use internal to the DAO.- Returns:
- the name of the container id field. For example "collection_id" or "community_id"
-
setContainerIDField
void setContainerIDField(String containerIDField)
set the name of the field in which to look for the container id.- Parameters:
containerIDField- the name of the container id field. For example "collection_id" or "community_id"
-
getJumpToField
String getJumpToField()
Get the field in which we will match a focus value from which to start the browse. This will either be the "sort_value" field or one of the additional sort fields defined by configuration- Returns:
- the name of the focus field
-
setJumpToField
void setJumpToField(String focusField)
Set the focus field upon which we will match a value from which to start the browse. This will either be the "sort_value" field or one of the additional sort fields defined by configuration- Parameters:
focusField- the name of the focus field
-
getJumpToValue
String getJumpToValue()
Get the value at which the browse will start. The value supplied here will be the top result on the page of results.- Returns:
- the value to start browsing on
-
setJumpToValue
void setJumpToValue(String focusValue)
Set the value upon which to start the browse from. The value supplied here will be the top result on the page of results- Parameters:
focusValue- the value in the focus field on which to start browsing
-
getLimit
int getLimit()
get the integer number which is the limit of the results that will be returned by any query. The default is -1, which means unlimited results.- Returns:
- the maximum possible number of results allowed to be returned
-
setLimit
void setLimit(int limit)
Set the limit for how many results should be returned. This is generally for use in paging or limiting the number of items be be displayed. The default is -1, meaning unlimited results. Note that if the number of results of the query is less than this number, the size of the result set will be smaller than this limit.- Parameters:
limit- the maximum number of results to return.
-
getOffset
int getOffset()
Get the offset from the first result from which to return results. This functionality is present for backwards compatibility, but is ill advised. All normal browse operations can be completed without it. The default is -1, which means do not offset.- Returns:
- paging offset
-
setOffset
void setOffset(int offset)
Get the offset from the first result from which to return results. This functionality is present for backwards compatibility, but is ill advised. All normal browse operations can be completed without it. The default is -1, which means do not offset.- Parameters:
offset- paging offset
-
getOrderField
String getOrderField()
Get the database field which will be used to do the sorting of result sets on.- Returns:
- the field by which results will be sorted
-
setOrderField
void setOrderField(String orderField)
Set the database field which will be used to sort result sets on- Parameters:
orderField- the field by which results will be sorted
-
getSelectValues
String[] getSelectValues()
Get the array of values that we will be selecting on. The default is to select all of the values from a given table- Returns:
- an array of values to select on
-
setSelectValues
void setSelectValues(String[] selectValues)
Set the array of values to select on. This should be a list of the columns available in the target table, or the SQL wildcards. The default is single element array with the standard wildcard (*)- Parameters:
selectValues- the values to select on
-
getCountValues
String[] getCountValues()
Get the array of fields that we will be counting on.- Returns:
- an array of fields to be counted over
-
setCountValues
void setCountValues(String[] fields)
Set the array of columns that we will be counting over. In general, the wildcard (*) will suffice- Parameters:
fields- an array of fields to be counted over
-
getTable
String getTable()
get the name of the table that we are querying- Returns:
- the name of the table
-
setTable
void setTable(String table)
Set the name of the table to query- Parameters:
table- the name of the table
-
setFilterMappingTables
void setFilterMappingTables(String tableDis, String tableMap)
Set the name of the mapping tables to use for filtering- Parameters:
tableDis- the name of the table holding the distinct valuestableMap- the name of the table holding the mappings
-
getFilterValue
String getFilterValue()
Get the value which we are constraining all our browse results to contain.- Returns:
- the value to which to constrain results
-
setFilterValue
void setFilterValue(String value)
Set the value to which all our browse results should be constrained. For example, if you are listing all of the publications by a single author your value would be the author name.- Parameters:
value- the value to which to constrain results
-
setFilterValuePartial
void setFilterValuePartial(boolean part)
Sets whether we will treat the filter value as partial (like match), or exact- Parameters:
part- true if partial, false if exact
-
getFilterValueField
String getFilterValueField()
Get the name of the field in which the value to constrain results is contained- Returns:
- the name of the field
-
setFilterValueField
void setFilterValueField(String valueField)
Set the name of the field in which the value to constrain results is contained- Parameters:
valueField- the name of the field
-
setDistinct
void setDistinct(boolean bool)
Set whether this is a distinct value browse or not- Parameters:
bool- true if distinct value, false if not
-
isDistinct
boolean isDistinct()
Is this a distinct value browse?- Returns:
- true if distinct, false if not
-
setContainerTable
void setContainerTable(String containerTable)
If we have specified a container id and container field, we must also specify a container table. This is the name of the table that maps the item onto the distinct value. Since we are in a container, this value will actually be the view which allows us to select only items which are within a given container- Parameters:
containerTable- the name of the container table mapping
-
getContainerTable
String getContainerTable()
Get the name of the container table that is being used to map items to distinct values when in a container constrained browse- Returns:
- the name of the table
-
setAuthorityValue
void setAuthorityValue(String value)
-
getAuthorityValue
String getAuthorityValue()
-
isEnableBrowseFrequencies
boolean isEnableBrowseFrequencies()
-
setEnableBrowseFrequencies
void setEnableBrowseFrequencies(boolean enableBrowseFrequencies)
-
setStartsWith
void setStartsWith(String startsWith)
-
getStartsWith
String getStartsWith()
-
-