edu.internet2.middleware.grouper.ui
Class AbstractRepositoryBrowser

java.lang.Object
  extended by edu.internet2.middleware.grouper.ui.AbstractRepositoryBrowser
All Implemented Interfaces:
RepositoryBrowser
Direct Known Subclasses:
AllRepositoryBrowser, CreateRepositoryBrowser, JoinRepositoryBrowser, ManageRepositoryBrowser, MyMembershipsRepositoryBrowser

public abstract class AbstractRepositoryBrowser
extends Object
implements RepositoryBrowser

Partial implementation of RepositoryBrowser used as a superclass for actual implementations so code can be shared where appropriate. Reads properties from media.properties: repository.browser.create.class=edu.internet2.middleware.grouper.ui.CreateRepositoryBrowser repository.browser.create.flat-capable=true repository.browser.create.root-node= repository.browser.create.hide-pre-root-node=true repository.browser.create.flat-privs=CREATE STEM repository.browser.create.flat-type=stem repository.browser.create.search=stems repository.browser.create.initial-stems=edu...InitialStemsImpl

Property Value Description
class edu.internet2.middleware.grouper.ui.CreateRepositoryBrowser RepositoryBrowserFactory.getInstance("Create") looks up this key and returns an instance of the class specified by the value
flat-capable true Indicates that the hierarchy can be hidden and a list of stems or groups (according to flat-type) shown
flat-type stem Currently, all other browse modes have a flat-type=group
flat-privs CREATE STEM The current subject must have one of these privs before a stem or group is listed
root-node   Name of a stem where browsing starts. Defaults to empty = root node, but could be at any level in the hierarchy. If not specified will look at media.properties:default.browse.stem
hide-pre-root-node true If a root node is specified this property determines if the user can browse to ancestor nodes of the root node. This feature can be used to present a restricted view of the hierarchy within the repository
search groups / stems Indicates what to search
initial-stems edu...InitialStemsImpl class name for an InitialStems implementation. Defaults to media.properties:plugin.initialstems value

By modifying these properties or writing new implementations sites can customize the behaviour of existing browse modes, and create their own. Coupled with the ability to control menu items, sites can adapt the Grouper UI to institutional requirements

Version:
$Id: AbstractRepositoryBrowser.java,v 1.25 2009-11-07 14:46:34 isgwb Exp $
Author:
Gary Brown.

Constructor Summary
AbstractRepositoryBrowser()
          Default no argument constructor
 
Method Summary
 List advancedSearch(GrouperSession s, String from, Map attr, List outTerms)
          Advanced search of repository
 List advancedStemSearch(GrouperSession s, String from, Map attr, List outTerms)
          Only accessible from Create groups, implements stem search logic
 Set<Group> getChildGroups(Stem stem, QueryOptions queryOptions)
          get child groups from a stem
 List<GroupOrStem> getChildren(GrouperSession s, String stemId, int start, int pageSize, int[] resultSize)
          Given a GrouperStem id return a list of stems and groups for which the GrouperStem is an immediate parent
 Set getChildren(String node, String listField, int start, int pageSize, StringBuffer totalCount, boolean isFlat, boolean isForAssignment, String omitForAssignment, String context, HttpServletRequest request)
          Given a node return children as appropriate for browse mode
 List<GroupAsMap> getChildrenAsMaps(GrouperSession s, String stemId, int start, int pageSize, int[] resultSize)
          Given a GrouperStem id return a list of Maps representing the children of that stem.
 Set<Stem> getChildStems(Stem stem)
          get child stems to show
 String getFlattenType()
          stems or groups - used to create correct screen text
 String getInitialStems()
          Returns the name of the implementation - if there is one
 List getParentStems(GroupOrStem groupOrStem)
          Returns a list of parent stems as maps taking account of root node properties
 String getRootNode()
          Each browse mode can have its own root node.
 void init(GrouperSession s, ResourceBundle bundle, ResourceBundle mediaBundle)
          Factory method uses no argument constructor.
 boolean isFlatCapable()
          Does this browse mode have a flat mode i.e.
 boolean isHidePreRootNode()
          Should the nodes before the root node be hidden?
 List search(GrouperSession s, String query, String from, Map attr, List outTerms)
          Search repository and return results as appropriate for the browse mode
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractRepositoryBrowser

public AbstractRepositoryBrowser()
Default no argument constructor

Method Detail

init

public void init(GrouperSession s,
                 ResourceBundle bundle,
                 ResourceBundle mediaBundle)
Description copied from interface: RepositoryBrowser
Factory method uses no argument constructor. init passes in the essentials

Specified by:
init in interface RepositoryBrowser

getFlattenType

public String getFlattenType()
Description copied from interface: RepositoryBrowser
stems or groups - used to create correct screen text

Specified by:
getFlattenType in interface RepositoryBrowser
Returns:
flatten type

getChildren

public Set getChildren(String node,
                       String listField,
                       int start,
                       int pageSize,
                       StringBuffer totalCount,
                       boolean isFlat,
                       boolean isForAssignment,
                       String omitForAssignment,
                       String context,
                       HttpServletRequest request)
                throws Exception
Description copied from interface: RepositoryBrowser
Given a node return children as appropriate for browse mode

Specified by:
getChildren in interface RepositoryBrowser
start - 0 based start index
Returns:
Set of children for current node
Throws:
Exception
See Also:
edu.internet2.middleware.grouper.ui.RepositoryBrowser#getChildren(java.lang.String, int, int, java.lang.StringBuffer, boolean, boolean)

getInitialStems

public String getInitialStems()
Description copied from interface: RepositoryBrowser
Returns the name of the implementation - if there is one

Specified by:
getInitialStems in interface RepositoryBrowser
Returns:
the name of the Java class

getParentStems

public List getParentStems(GroupOrStem groupOrStem)
                    throws Exception
Description copied from interface: RepositoryBrowser
Returns a list of parent stems as maps taking account of root node properties

Specified by:
getParentStems in interface RepositoryBrowser
Returns:
List of anvestor stems for specified group or stem
Throws:
Exception

search

public List search(GrouperSession s,
                   String query,
                   String from,
                   Map attr,
                   List outTerms)
            throws Exception
Description copied from interface: RepositoryBrowser
Search repository and return results as appropriate for the browse mode

Specified by:
search in interface RepositoryBrowser
Returns:
List of stems or groups. A human readable list of search terms is also returned if a List is provided
Throws:
Exception

advancedStemSearch

public List advancedStemSearch(GrouperSession s,
                               String from,
                               Map attr,
                               List outTerms)
                        throws Exception
Only accessible from Create groups, implements stem search logic

Parameters:
s -
from -
attr -
outTerms -
Returns:
list of Stems matching search criteria
Throws:
Exception

advancedSearch

public List advancedSearch(GrouperSession s,
                           String from,
                           Map attr,
                           List outTerms)
                    throws Exception
Description copied from interface: RepositoryBrowser
Advanced search of repository

Specified by:
advancedSearch in interface RepositoryBrowser
outTerms - - empty list used to return info for deriving human readable query
Returns:
List of stems or groups. A human readable list of search terms is also returned if a List is provided
Throws:
Exception

isFlatCapable

public boolean isFlatCapable()
Description copied from interface: RepositoryBrowser
Does this browse mode have a flat mode i.e. can it hide the hierarchy?

Specified by:
isFlatCapable in interface RepositoryBrowser
Returns:
Returns the isFlatCapable.

getRootNode

public String getRootNode()
Description copied from interface: RepositoryBrowser
Each browse mode can have its own root node.

Specified by:
getRootNode in interface RepositoryBrowser
Returns:
Returns the rootNode.

isHidePreRootNode

public boolean isHidePreRootNode()
Description copied from interface: RepositoryBrowser
Should the nodes before the root node be hidden?

Specified by:
isHidePreRootNode in interface RepositoryBrowser
Returns:
Returns the hidePreRootNode.

getChildren

public List<GroupOrStem> getChildren(GrouperSession s,
                                     String stemId,
                                     int start,
                                     int pageSize,
                                     int[] resultSize)
                              throws StemNotFoundException
Given a GrouperStem id return a list of stems and groups for which the GrouperStem is an immediate parent

Parameters:
s - GrouperSession for authenticated user
stemId - GrouperStem id
inPrivSet - set of privileges the subject must have in each row
start -
pageSize -
resultSize - result size of whole resultset
Returns:
List of all stems and groups for stemId
Throws:
StemNotFoundException

getChildGroups

public Set<Group> getChildGroups(Stem stem,
                                 QueryOptions queryOptions)
get child groups from a stem

Parameters:
stem -
scope -
Returns:
the set of groups

getChildStems

public Set<Stem> getChildStems(Stem stem)
get child stems to show

Parameters:
stem -
Returns:
the stems

getChildrenAsMaps

public List<GroupAsMap> getChildrenAsMaps(GrouperSession s,
                                          String stemId,
                                          int start,
                                          int pageSize,
                                          int[] resultSize)
                                   throws StemNotFoundException
Given a GrouperStem id return a list of Maps representing the children of that stem.

Parameters:
s - GrouperSession for authenticated user
stemId -
inPrivSet - rows must have privs here
start -
pageSize -
resultSize -
Returns:
List of GrouperGroups and GrouperStems wrapped as Maps
Throws:
StemNotFoundException