Interface BrowseDAO

All Known Implementing Classes:
SolrBrowseDAO

public interface BrowseDAO
Interface 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

    Modifier and Type
    Method
    Description
    int
    This executes a query which will count the number of results for the parameters you set.
    int
    doDistinctOffsetQuery(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.
    doMaxQuery(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.
    int
    doOffsetQuery(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.
    This executes a query which returns a List object containing BrowseItem objects representing the results of a full item browse.
    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).
     
    Get the container object.
    get the name of the field in which to look for the container id.
    Get the name of the container table that is being used to map items to distinct values when in a container constrained browse
    Get the array of fields that we will be counting on.
    Get the value which we are constraining all our browse results to contain.
    Get the name of the field in which the value to constrain results is contained
    Get the field in which we will match a focus value from which to start the browse.
    Get the value at which the browse will start.
    int
    get the integer number which is the limit of the results that will be returned by any query.
    int
    Get the offset from the first result from which to return results.
    Get the database field which will be used to do the sorting of result sets on.
    Get the array of values that we will be selecting on.
     
    get the name of the table that we are querying
    boolean
    Is the sort order ascending or descending?
    boolean
    Is this a distinct value browse?
    boolean
     
    void
    setAscending(boolean ascending)
    Set whether the results should be sorted in ascending order (on the given sort column) or descending order.
    void
     
    void
    Set the container object.
    void
    setContainerIDField(String containerIDField)
    set the name of the field in which to look for the container id.
    void
    setContainerTable(String containerTable)
    If we have specified a container id and container field, we must also specify a container table.
    void
    Set the array of columns that we will be counting over.
    void
    setDistinct(boolean bool)
    Set whether this is a distinct value browse or not
    void
    setEnableBrowseFrequencies(boolean enableBrowseFrequencies)
     
    void
    setEqualsComparator(boolean equalsComparator)
    Set whether the query should use an equals comparator when doing less than or greater than comparisons.
    void
    setFilterMappingTables(String tableDis, String tableMap)
    Set the name of the mapping tables to use for filtering
    void
    Set the value to which all our browse results should be constrained.
    void
    Set the name of the field in which the value to constrain results is contained
    void
    setFilterValuePartial(boolean part)
    Sets whether we will treat the filter value as partial (like match), or exact
    void
    setJumpToField(String focusField)
    Set the focus field upon which we will match a value from which to start the browse.
    void
    setJumpToValue(String focusValue)
    Set the value upon which to start the browse from.
    void
    setLimit(int limit)
    Set the limit for how many results should be returned.
    void
    setOffset(int offset)
    Get the offset from the first result from which to return results.
    void
    setOrderField(String orderField)
    Set the database field which will be used to sort result sets on
    void
    setSelectValues(String[] selectValues)
    Set the array of values to select on.
    void
    setStartsWith(String startsWith)
     
    void
    Set the name of the table to query
    boolean
    Does the query use the equals comparator when doing less than or greater than comparisons.
  • Method Details

    • doCountQuery

      int doCountQuery() throws BrowseException
      This 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 interrogate
      table - the table to query
      itemID - 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 interrogate
      value - the item id
      isAscending - 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 interrogate
      value - the item id
      isAscending - 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 values
      tableMap - 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()