Class BrowseInfo


  • public class BrowseInfo
    extends Object
    The results of a Browse, including all the contextual information about the query, as well as the results and associated information to create pageable navigation.
    Author:
    Richard Jones
    • Constructor Detail

      • BrowseInfo

        public BrowseInfo​(List results,
                          int overallPosition,
                          int total,
                          int offset)
        Constructor FIXME: Unable to generify due to mixed usage
        Parameters:
        results - A List of Browse results
        overallPosition - The position of the first returned item in the overall index
        total - The total number of items in the index
        offset - The position of the requested item in the set of results
    • Method Detail

      • getEtAl

        public int getEtAl()
        Returns:
        the number of metadata fields at which to truncate with "et al"
      • setEtAl

        public void setEtAl​(int etAl)
        set the number of metadata fields at which to truncate with "et al"
        Parameters:
        etAl - the number of metadata fields at which to truncate with "et al"
      • getFocusItem

        public int getFocusItem()
        Returns:
        Returns the focusItem.
      • setFocusItem

        public void setFocusItem​(int focusItem)
        Parameters:
        focusItem - The focusItem to set.
      • hasItemFocus

        public boolean hasItemFocus()
        Does this browse have an item focus (as opposed to one of: no focus, a value focus)
        Returns:
        true if item focus, false if not
      • getResultsPerPage

        public int getResultsPerPage()
        Returns:
        Returns the resultsPerPage.
      • setResultsPerPage

        public void setResultsPerPage​(int resultsPerPage)
        Parameters:
        resultsPerPage - The resultsPerPage to set.
      • hasValue

        public boolean hasValue()
        Is there a value associated with this browse
        Returns:
        true if a value, false if not
      • hasAuthority

        public boolean hasAuthority()
        Is there an authority key associated with this browse
        Returns:
        true if an authority key, false if not
      • hasResults

        public boolean hasResults()
        Are there results for this browse, or was the result set empty?
        Returns:
        true if results, false if not
      • setFocus

        public void setFocus​(String focus)
        Parameters:
        focus - the value to focus the browse around
      • getFocus

        public String getFocus()
        Returns:
        the value to focus the browse around
      • setBrowseContainer

        public void setBrowseContainer​(DSpaceObject dso)
                                throws BrowseException
        Set the DSpaceObject that is the container for this browse. If this is not of type Collection or Community, this method will throw an exception
        Parameters:
        dso - the container object; a Community or Collection
        Throws:
        BrowseException - if browse error
      • getBrowseContainer

        public DSpaceObject getBrowseContainer()
        Obtain a DSpaceObject that represents the container object. This will be a Community or a Collection
        Returns:
        A DSpaceObject representing a Community or a Collection
      • setBrowseLevel

        public void setBrowseLevel​(int level)
        Parameters:
        level - the browse level
      • getBrowseLevel

        public int getBrowseLevel()
        Returns:
        the browse level
      • setNextOffset

        public void setNextOffset​(int offset)
        Parameters:
        offset - the database id of the item at the top of the next page
      • getNextOffset

        public int getNextOffset()
        Returns:
        the database id of the item at the top of the next page
      • isAscending

        public boolean isAscending()
        Returns:
        Returns the ascending.
      • setAscending

        public void setAscending​(boolean ascending)
        Parameters:
        ascending - The ascending to set.
      • getBrowseIndex

        public BrowseIndex getBrowseIndex()
        Returns:
        Returns the browseIndex.
      • setBrowseIndex

        public void setBrowseIndex​(BrowseIndex browseIndex)
        Parameters:
        browseIndex - The browseIndex to set.
      • getPrevOffset

        public int getPrevOffset()
        Returns:
        Returns the prevItem.
      • setPrevOffset

        public void setPrevOffset​(int prevOffset)
        Parameters:
        prevOffset - The prevOffset to set.
      • getSortOption

        public SortOption getSortOption()
        Returns:
        Returns the sortOption.
      • setSortOption

        public void setSortOption​(SortOption sortOption)
        Parameters:
        sortOption - The sortOption to set.
      • isStartsWith

        public boolean isStartsWith()
        Returns:
        Returns the startsWith.
      • setStartsWith

        public void setStartsWith​(boolean startsWith)
        Parameters:
        startsWith - The startsWith to set.
      • getValue

        public String getValue()
        Returns:
        Returns the value.
      • setValue

        public void setValue​(String value)
        Parameters:
        value - The value to set.
      • getAuthority

        public String getAuthority()
        Returns:
        Returns the authority key.
      • setAuthority

        public void setAuthority​(String authority)
        Parameters:
        authority - The authority key to set.
      • isTopLevel

        public boolean isTopLevel()
        is this a top level (0) browse? Examples of this are a full item browse or a single browse. Other browse types are considered second level (1)
        Returns:
        true if top level, false if not
      • isSecondLevel

        public boolean isSecondLevel()
        Is this a second level (1) browse? Examples of this are a single value browse (e.g. all items by a given author)
        Returns:
        true if second level, false if not
      • getResults

        public List<Item> getResults()
        The results of the Browse. Each member of the list is either a String array (for the authors browse: first element the value, second element the authority key) or an Item(for the other browses).
        Returns:
        Result list. This list cannot be modified.
      • getStringResults

        public String[][] getStringResults()
        Return the results of the Browse as an array of String array. The first element (i.e. index 0) is the value, the second is the authority key
        Returns:
        The results of the Browse as a String array.
      • getItemResults

        @Deprecated
        public Item[] getItemResults()
        Deprecated.
        Returns:
        an empty array of Item.
      • getBrowseItemResults

        public List<Item> getBrowseItemResults()
        Return the results of the Browse as a BrowseItem array
        Returns:
        the results of the browse as a BrowseItem array
      • getResultCount

        public int getResultCount()
        Return the number of results.
        Returns:
        The number of results.
      • getOverallPosition

        public int getOverallPosition()
        Return the position of the results in index being browsed. This is 0 for the start of the index.
        Returns:
        The position of the results in index being browsed.
      • getTotal

        public int getTotal()
        Return the total number of items in the index.
        Returns:
        The total number of items in the index.
      • getOffset

        public int getOffset()
        Return the position of the requested item or value in the set of results.
        Returns:
        The position of the requested item or value in the set of results
      • isFirst

        public boolean isFirst()
        True if there are no previous results from the browse.
        Returns:
        True if there are no previous results from the browse
      • isLast

        public boolean isLast()
        True if these are the last results from the browse.
        Returns:
        True if these are the last results from the browse
      • wasCached

        public boolean wasCached()
        True if this browse was cached.
        Returns:
        true/false
      • inCommunity

        public boolean inCommunity()
        are we browsing within a Community container?
        Returns:
        true if in community, false if not
      • inCollection

        public boolean inCollection()
        are we browsing within a Collection container
        Returns:
        true if in collection, false if not
      • hasNextPage

        public boolean hasNextPage()
        Are there further results for the browse that haven't been returned yet?
        Returns:
        true if next page, false if not
      • hasPrevPage

        public boolean hasPrevPage()
        Are there results prior to these that haven't been returned here?
        Returns:
        true if previous page, false if not
      • hasFocus

        public boolean hasFocus()
        Does this browse have a focus?
        Returns:
        true if focus, false if not
      • getStart

        public int getStart()
        Get an integer representing the number within the total set of results which marks the position of the first result in the current sub-set
        Returns:
        the start point of the browse page
      • getFinish

        public int getFinish()
        Get an integer representing the number within the total set of results which marks the position of the last result in the current sub-set
        Returns:
        the end point of the browse page
      • toString

        public String toString()
        Utility method for obtaining a string representation of the browse. This is useful only for debug
        Overrides:
        toString in class Object
        Returns:
        String representation