edu.internet2.middleware.grouper.ui.actions
Class LowLevelGrouperCapableAction

java.lang.Object
  extended by org.apache.struts.action.Action
      extended by edu.internet2.middleware.grouper.ui.actions.LowLevelGrouperCapableAction
Direct Known Subclasses:
GetDynamicTileAction, GrouperCapableAction, PrepareBrowsePathAction, PrepareFlattenAction, PrepareGroupSearchFormAction, PrepareMenuAction, PrepareRepositoryBrowserStemsAction, PrepareSavedStemsAction, PrepareSavedSubjectsAction, PrepareStemsAction, PrepareSubjectSearchFormAction, PropogateTilesAttributesAction

public abstract class LowLevelGrouperCapableAction
extends Action

Author:
isgwb TODO To change the template for this generated type comment go to Window - Preferences - Java - Code Style - Code Templates

Field Summary
static String HIER_DELIM
           
 
Constructor Summary
LowLevelGrouperCapableAction()
           
 
Method Summary
 ActionForward execute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response)
          Makes HttpSession and GrouperSession available to subclasses Also handles pageSize parameter and times how long is spent in an action
 Object findAttribute(String name, HttpServletRequest request)
          Convenience method checks request for attribute.
 Boolean getAdvancedSearchMode(HttpSession session)
          Place centrally for consistency and to hide session attribute name
 String getBrowseMode(HttpSession session)
          Place centrally for consistency and to hide session attribute name
 String getBrowseNode(HttpSession session)
          Place centrally for consistency and to hide session attribute name
static Cookie getCookie(String name, HttpServletRequest request)
          Return a named cookie - so caling code doesn`t have to iterate through Cookie array
 GroupOrStem getCurrentGroupOrStem(GrouperSession s, HttpSession session)
          Place centrally for consistency and convenience - gets default specified in media ResourceBundle if none set
 String getDefaultRootStemName(HttpSession session)
          Return configured stem - or the root stem if none configured
static NavExceptionHelper getExceptionHelper(HttpSession session)
           
 String getLinkBrowseMode(HttpSession session)
          Place centrally for consistency and to hide session attribute name
 int getPageSize(HttpSession session)
          Convenience method to stop duplication of logic in Actions
 Map getTilesAttributes(HttpServletRequest request)
          Convenience method to extract tiles attributes as a Map
abstract  ActionForward grouperExecute(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response, HttpSession session, GrouperSession grouperSession)
          Action specific - must be implemented by all subclasses
static boolean isEmpty(Object obj)
          Convenience method to simplify calling code
static Map readDebugPrefs(HttpServletRequest request)
          Functionality moved here from PopulateDebugPrefsAction so can be called from elsewhere
 boolean saveDebugPrefs(Map map, HttpServletRequest request)
           
static void setBrowseMode(String mode, HttpSession session)
          Place centrally for consistency and to hide session attribute name
 void setBrowseNode(String node, HttpSession session)
          Place centrally for consistency and to hide session attribute name
static List sort(Collection input, HttpServletRequest request, String context, int collectionSize)
          This method assumes that there is a HttpSession attribute, 'GrouperComparator', which is an implementation of the GrouperComparator interface.
 
Methods inherited from class org.apache.struts.action.Action
execute, getServlet, setServlet
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HIER_DELIM

public static final String HIER_DELIM
See Also:
Constant Field Values
Constructor Detail

LowLevelGrouperCapableAction

public LowLevelGrouperCapableAction()
Method Detail

grouperExecute

public abstract ActionForward grouperExecute(ActionMapping mapping,
                                             ActionForm form,
                                             HttpServletRequest request,
                                             HttpServletResponse response,
                                             HttpSession session,
                                             GrouperSession grouperSession)
                                      throws Exception
Action specific - must be implemented by all subclasses

Throws:
Exception

execute

public ActionForward execute(ActionMapping mapping,
                             ActionForm form,
                             HttpServletRequest request,
                             HttpServletResponse response)
                      throws Exception
Makes HttpSession and GrouperSession available to subclasses Also handles pageSize parameter and times how long is spent in an action

Overrides:
execute in class Action
Throws:
Exception

getTilesAttributes

public Map getTilesAttributes(HttpServletRequest request)
Convenience method to extract tiles attributes as a Map


findAttribute

public Object findAttribute(String name,
                            HttpServletRequest request)
Convenience method checks request for attribute. If not present checks session TODO: check application


isEmpty

public static boolean isEmpty(Object obj)
Convenience method to simplify calling code


getPageSize

public int getPageSize(HttpSession session)
Convenience method to stop duplication of logic in Actions


getLinkBrowseMode

public String getLinkBrowseMode(HttpSession session)
Place centrally for consistency and to hide session attribute name


getBrowseMode

public String getBrowseMode(HttpSession session)
Place centrally for consistency and to hide session attribute name


setBrowseMode

public static void setBrowseMode(String mode,
                                 HttpSession session)
Place centrally for consistency and to hide session attribute name


getBrowseNode

public String getBrowseNode(HttpSession session)
Place centrally for consistency and to hide session attribute name


setBrowseNode

public void setBrowseNode(String node,
                          HttpSession session)
Place centrally for consistency and to hide session attribute name


getAdvancedSearchMode

public Boolean getAdvancedSearchMode(HttpSession session)
Place centrally for consistency and to hide session attribute name


getCurrentGroupOrStem

public GroupOrStem getCurrentGroupOrStem(GrouperSession s,
                                         HttpSession session)
                                  throws Exception
Place centrally for consistency and convenience - gets default specified in media ResourceBundle if none set

Throws:
Exception

getDefaultRootStemName

public String getDefaultRootStemName(HttpSession session)
Return configured stem - or the root stem if none configured

Parameters:
session -
Returns:
name of the default root stem

getCookie

public static Cookie getCookie(String name,
                               HttpServletRequest request)
Return a named cookie - so caling code doesn`t have to iterate through Cookie array

Parameters:
name -
request -
Returns:
Cookie with specified name

readDebugPrefs

public static Map readDebugPrefs(HttpServletRequest request)
                          throws Exception
Functionality moved here from PopulateDebugPrefsAction so can be called from elsewhere

Parameters:
request -
Returns:
Map representing saved preferences
Throws:
Exception

saveDebugPrefs

public boolean saveDebugPrefs(Map map,
                              HttpServletRequest request)
                       throws Exception
Throws:
Exception

sort

public static List sort(Collection input,
                        HttpServletRequest request,
                        String context,
                        int collectionSize)
This method assumes that there is a HttpSession attribute, 'GrouperComparator', which is an implementation of the GrouperComparator interface. If not present this method will instantiate an implementation instance using the value for the media.properties key 'comparator.impl'. The media.properties key 'comparator.sort.limit' defines the maximum input size that will be sorted. If the input Collection is larger than this limit, it is effectively returned as is, though if the Collection was not a List it will be returned as an ArrayList.

Parameters:
input - the Collection to sort
request - the current request object
context - the context in which sorting is taking place
collectionSize - is the total size of the collection, or -1 if the collection is the entire thing
Returns:
the input Collection as a sorted List
See Also:
DefaultComparatorImpl

getExceptionHelper

public static NavExceptionHelper getExceptionHelper(HttpSession session)