Package org.dspace.browse
Class SolrBrowseDAO
- java.lang.Object
-
- org.dspace.browse.SolrBrowseDAO
-
-
Field Summary
Fields Modifier and Type Field Description protected AuthorizeServiceauthorizeService
-
Constructor Summary
Constructors Constructor Description SolrBrowseDAO(Context context)
-
Method Summary
All Methods Instance Methods Concrete 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.ListdoValueQuery()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()UUIDgetContainerID()Get the database ID of 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)voidsetContainerID(UUID containerID)Set the database id of 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 he 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.
-
-
-
Field Detail
-
authorizeService
protected AuthorizeService authorizeService
-
-
Constructor Detail
-
SolrBrowseDAO
public SolrBrowseDAO(Context context)
-
-
Method Detail
-
doCountQuery
public int doCountQuery() throws BrowseExceptionDescription copied from interface:BrowseDAOThis executes a query which will count the number of results for the parameters you set.- Specified by:
doCountQueryin interfaceBrowseDAO- Returns:
- the integer value of the number of results found
- Throws:
BrowseException- if browse error
-
doValueQuery
public List doValueQuery() throws BrowseException
Description copied from interface:BrowseDAOThis 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.- Specified by:
doValueQueryin interfaceBrowseDAO- Returns:
- List of Strings representing the single value query results
- Throws:
BrowseException- if browse error
-
doQuery
public List<Item> doQuery() throws BrowseException
Description copied from interface:BrowseDAOThis executes a query which returns a List object containing BrowseItem objects representing the results of a full item browse.- Specified by:
doQueryin interfaceBrowseDAO- Returns:
- List of BrowseItem objects
- Throws:
BrowseException- if browse error
-
doMaxQuery
public String doMaxQuery(String column, String table, int itemID) throws BrowseException
Description copied from interface:BrowseDAOThis executes a query which returns the value of the "highest" (max) value in the given table's column for the given item id.- Specified by:
doMaxQueryin interfaceBrowseDAO- 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
public int doOffsetQuery(String column, String value, boolean isAscending) throws BrowseException
Description copied from interface:BrowseDAOThis 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.- Specified by:
doOffsetQueryin interfaceBrowseDAO- 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
public int doDistinctOffsetQuery(String column, String value, boolean isAscending) throws BrowseException
Description copied from interface:BrowseDAOThis 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.- Specified by:
doDistinctOffsetQueryin interfaceBrowseDAO- 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
-
isEnableBrowseFrequencies
public boolean isEnableBrowseFrequencies()
- Specified by:
isEnableBrowseFrequenciesin interfaceBrowseDAO
-
setEnableBrowseFrequencies
public void setEnableBrowseFrequencies(boolean enableBrowseFrequencies)
- Specified by:
setEnableBrowseFrequenciesin interfaceBrowseDAO
-
getContainerID
public UUID getContainerID()
Description copied from interface:BrowseDAOGet the database ID of the container object. The container object will be a Community or a Collection.- Specified by:
getContainerIDin interfaceBrowseDAO- Returns:
- the database id of the container, or -1 if none is set
-
getContainerIDField
public String getContainerIDField()
Description copied from interface:BrowseDAOget the name of the field in which to look for the container id. This is principally for use internal to the DAO.- Specified by:
getContainerIDFieldin interfaceBrowseDAO- Returns:
- the name of the container id field. For example "collection_id" or "community_id"
-
getContainerTable
public String getContainerTable()
Description copied from interface:BrowseDAOGet the name of the container table that is being used to map items to distinct values when in a container constrained browse- Specified by:
getContainerTablein interfaceBrowseDAO- Returns:
- the name of the table
-
getCountValues
public String[] getCountValues()
Description copied from interface:BrowseDAOGet the array of fields that we will be counting on.- Specified by:
getCountValuesin interfaceBrowseDAO- Returns:
- an array of fields to be counted over
-
getJumpToField
public String getJumpToField()
Description copied from interface:BrowseDAOGet 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- Specified by:
getJumpToFieldin interfaceBrowseDAO- Returns:
- the name of the focus field
-
getJumpToValue
public String getJumpToValue()
Description copied from interface:BrowseDAOGet the value at which the browse will start. The value supplied here will be the top result on the page of results.- Specified by:
getJumpToValuein interfaceBrowseDAO- Returns:
- the value to start browsing on
-
setStartsWith
public void setStartsWith(String startsWith)
- Specified by:
setStartsWithin interfaceBrowseDAO
-
getStartsWith
public String getStartsWith()
- Specified by:
getStartsWithin interfaceBrowseDAO
-
getLimit
public int getLimit()
Description copied from interface:BrowseDAOget 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.
-
getOffset
public int getOffset()
Description copied from interface:BrowseDAOGet 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.
-
getOrderField
public String getOrderField()
Description copied from interface:BrowseDAOGet the database field which will be used to do the sorting of result sets on.- Specified by:
getOrderFieldin interfaceBrowseDAO- Returns:
- the field by which results will be sorted
-
getSelectValues
public String[] getSelectValues()
Description copied from interface:BrowseDAOGet the array of values that we will be selecting on. The default is to select all of the values from a given table- Specified by:
getSelectValuesin interfaceBrowseDAO- Returns:
- an array of values to select on
-
getTable
public String getTable()
Description copied from interface:BrowseDAOget the name of the table that we are querying
-
getFilterValue
public String getFilterValue()
Description copied from interface:BrowseDAOGet the value which we are constraining all our browse results to contain.- Specified by:
getFilterValuein interfaceBrowseDAO- Returns:
- the value to which to constrain results
-
getFilterValueField
public String getFilterValueField()
Description copied from interface:BrowseDAOGet the name of the field in which the value to constrain results is contained- Specified by:
getFilterValueFieldin interfaceBrowseDAO- Returns:
- the name of the field
-
isAscending
public boolean isAscending()
Description copied from interface:BrowseDAOIs the sort order ascending or descending? Default value is true- Specified by:
isAscendingin interfaceBrowseDAO- Returns:
- true for ascending, false for descending
-
isDistinct
public boolean isDistinct()
Description copied from interface:BrowseDAOIs this a distinct value browse?- Specified by:
isDistinctin interfaceBrowseDAO- Returns:
- true if distinct, false if not
-
setAscending
public void setAscending(boolean ascending)
Description copied from interface:BrowseDAOSet whether the results should be sorted in ascending order (on the given sort column) or descending order.- Specified by:
setAscendingin interfaceBrowseDAO- Parameters:
ascending- true to ascend, false to descend
-
setContainerID
public void setContainerID(UUID containerID)
Description copied from interface:BrowseDAOSet the database id of the container object. This should be the id of 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.- Specified by:
setContainerIDin interfaceBrowseDAO- Parameters:
containerID- community/collection internal ID (UUID)
-
setContainerIDField
public void setContainerIDField(String containerIDField)
Description copied from interface:BrowseDAOset the name of the field in which to look for the container id.- Specified by:
setContainerIDFieldin interfaceBrowseDAO- Parameters:
containerIDField- the name of the container id field. For example "collection_id" or "community_id"
-
setContainerTable
public void setContainerTable(String containerTable)
Description copied from interface:BrowseDAOIf 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- Specified by:
setContainerTablein interfaceBrowseDAO- Parameters:
containerTable- the name of the container table mapping
-
setCountValues
public void setCountValues(String[] fields)
Description copied from interface:BrowseDAOSet the array of columns that we will be counting over. In general, the wildcard (*) will suffice- Specified by:
setCountValuesin interfaceBrowseDAO- Parameters:
fields- an array of fields to be counted over
-
setDistinct
public void setDistinct(boolean bool)
Description copied from interface:BrowseDAOSet whether this is a distinct value browse or not- Specified by:
setDistinctin interfaceBrowseDAO- Parameters:
bool- true if distinct value, false if not
-
setEqualsComparator
public void setEqualsComparator(boolean equalsComparator)
Description copied from interface:BrowseDAOSet 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>- Specified by:
setEqualsComparatorin interfaceBrowseDAO- Parameters:
equalsComparator- true to use, false to not.
-
setJumpToField
public void setJumpToField(String focusField)
Description copied from interface:BrowseDAOSet 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- Specified by:
setJumpToFieldin interfaceBrowseDAO- Parameters:
focusField- the name of the focus field
-
setJumpToValue
public void setJumpToValue(String focusValue)
Description copied from interface:BrowseDAOSet the value upon which to start the browse from. The value supplied here will be the top result on the page of results- Specified by:
setJumpToValuein interfaceBrowseDAO- Parameters:
focusValue- the value in the focus field on which to start browsing
-
setLimit
public void setLimit(int limit)
Description copied from interface:BrowseDAOSet 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.
-
setOffset
public void setOffset(int offset)
Description copied from interface:BrowseDAOGet 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.
-
setOrderField
public void setOrderField(String orderField)
Description copied from interface:BrowseDAOSet the database field which will be used to sort result sets on- Specified by:
setOrderFieldin interfaceBrowseDAO- Parameters:
orderField- the field by which results will be sorted
-
setSelectValues
public void setSelectValues(String[] selectValues)
Description copied from interface:BrowseDAOSet 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 (*)- Specified by:
setSelectValuesin interfaceBrowseDAO- Parameters:
selectValues- the values to select on
-
setTable
public void setTable(String table)
Description copied from interface:BrowseDAOSet the name of the table to query
-
setFilterMappingTables
public void setFilterMappingTables(String tableDis, String tableMap)
Description copied from interface:BrowseDAOSet the name of the mapping tables to use for filtering- Specified by:
setFilterMappingTablesin interfaceBrowseDAO- Parameters:
tableDis- the name of the table holding the distinct valuestableMap- the name of the table holding the mappings
-
setFilterValue
public void setFilterValue(String value)
Description copied from interface:BrowseDAOSet 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.- Specified by:
setFilterValuein interfaceBrowseDAO- Parameters:
value- the value to which to constrain results
-
setFilterValuePartial
public void setFilterValuePartial(boolean part)
Description copied from interface:BrowseDAOSets whether we will treat the filter value as partial (like match), or exact- Specified by:
setFilterValuePartialin interfaceBrowseDAO- Parameters:
part- true if partial, false if exact
-
setFilterValueField
public void setFilterValueField(String valueField)
Description copied from interface:BrowseDAOSet he name of the field in which the value to constrain results is contained- Specified by:
setFilterValueFieldin interfaceBrowseDAO- Parameters:
valueField- the name of the field
-
useEqualsComparator
public boolean useEqualsComparator()
Description copied from interface:BrowseDAODoes the query use the equals comparator when doing less than or greater than comparisons. @see setEqualsComparator Default value is true- Specified by:
useEqualsComparatorin interfaceBrowseDAO- Returns:
- true if using it, false if not
-
getAuthorityValue
public String getAuthorityValue()
- Specified by:
getAuthorityValuein interfaceBrowseDAO
-
setAuthorityValue
public void setAuthorityValue(String value)
- Specified by:
setAuthorityValuein interfaceBrowseDAO
-
-