org.dspace.browse
Class BrowseInfo

java.lang.Object
  extended by org.dspace.browse.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 pagable navigation.

Author:
Richard Jones

Constructor Summary
BrowseInfo(List results, int overallPosition, int total, int offset)
          Constructor
 
Method Summary
 String getAuthority()
           
 DSpaceObject getBrowseContainer()
          Obtain a DSpaceObject that represents the container object.
 BrowseIndex getBrowseIndex()
           
 BrowseItem[] getBrowseItemResults()
          Return the results of the Browse as a BrowseItem array
 int getBrowseLevel()
           
 int getEtAl()
           
 int getFinish()
          Get an integer representing the number within the total set of results which marks the poisition of the last result in the current sub-set
 String getFocus()
           
 int getFocusItem()
           
 Item[] getItemResults()
          Deprecated.  
 Item[] getItemResults(Context context)
          Return the results of the Browse as an Item array.
 int getNextOffset()
           
 int getOffset()
          Return the position of the requested item or value in the set of results.
 int getOverallPosition()
          Return the position of the results in index being browsed.
 int getPrevOffset()
           
 int getResultCount()
          Return the number of results.
 List getResults()
          The results of the Browse.
 int getResultsPerPage()
           
 SortOption getSortOption()
           
 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
 String[][] getStringResults()
          Return the results of the Browse as an array of String array.
 int getTotal()
          Return the total number of items in the index.
 String getValue()
           
 boolean hasAuthority()
          Is there an authority key associated with this browse
 boolean hasFocus()
          Does this browse have a focus?
 boolean hasItemFocus()
          Does this browse have an item focus (as opposed to one of: no focus, a value focus)
 boolean hasNextPage()
          Are there further results for the browse that haven't been returned yet?
 boolean hasPrevPage()
          Are there results prior to these that haven't been returned here?
 boolean hasResults()
          Are there results for this browse, or was the result set empty?
 boolean hasValue()
          Is there a value associated with this browse
 boolean inCollection()
          are we browsing within a Collection container
 boolean inCommunity()
          are we browsing within a Community container?
 boolean isAscending()
           
 boolean isFirst()
          True if there are no previous results from the browse.
 boolean isLast()
          True if these are the last results from the browse.
 boolean isSecondLevel()
          Is this a second level (1) browse? Examples of this are a single value browse (e.g.
 boolean isStartsWith()
           
 boolean isTopLevel()
          is this a top level (0) browse? Examples of this are a full item browse or a single browse.
 void setAscending(boolean ascending)
           
 void setAuthority(String authority)
           
 void setBrowseContainer(DSpaceObject dso)
          Set the DSpaceObject that is the container for this browse.
 void setBrowseIndex(BrowseIndex browseIndex)
           
 void setBrowseLevel(int level)
           
 void setEtAl(int etAl)
          set the number of metadata fields at which to truncate with "et al"
 void setFocus(String focus)
           
 void setFocusItem(int focusItem)
           
 void setNextOffset(int offset)
           
 void setPrevOffset(int prevOffset)
           
 void setResultsPerPage(int resultsPerPage)
           
 void setSortOption(SortOption sortOption)
           
 void setStartsWith(boolean startsWith)
           
 void setValue(String value)
           
 String toString()
          Utility method for obtaining a string representation of the browse.
 boolean wasCached()
          True if this browse was cached.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BrowseInfo

public BrowseInfo(List results,
                  int overallPosition,
                  int total,
                  int offset)
Constructor

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 -

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

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:
id - 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:
prevItem - The prevItem 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:
value - 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 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

public Item[] getItemResults()
Deprecated. 

Returns:

getItemResults

public Item[] getItemResults(Context context)
                      throws BrowseException
Return the results of the Browse as an Item array.

Returns:
The results of the Browse as an Item array.
Throws:
BrowseException

getBrowseItemResults

public BrowseItem[] 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.


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 poisition 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


Copyright © 2010 DuraSpace. All Rights Reserved.