Class GlobalVariables

java.lang.Object
org.kuali.rice.krad.util.GlobalVariables

public final class GlobalVariables extends Object
Holds all of our thread local variables and accessors for those
Author:
Kuali Rice Team (rice.collab@kuali.org)
  • Method Details

    • getCurrentGlobalVariables

      public static GlobalVariables getCurrentGlobalVariables()
    • injectGlobalVariables

      public static void injectGlobalVariables(GlobalVariables globalVariables)
    • popGlobalVariables

      public static GlobalVariables popGlobalVariables()
    • getUserSession

      public static org.kuali.rice.krad.UserSession getUserSession()
      Returns:
      the UserSession that has been assigned to this thread of execution it is important that this not be called by anything that lives outside
    • setHideSessionFromTestsMessage

      public static void setHideSessionFromTestsMessage(String message)
      Sets an error message for tests that try to use the session without declaring it. This method should be use by only KualiTestBase, not by other test code and especially not by production code.
      Parameters:
      message - the detail to throw, or null to allow access to the session
    • setUserSession

      public static void setUserSession(org.kuali.rice.krad.UserSession userSession)
      sets the userSession object into the global variable for this thread
    • getMessageMap

      public static org.kuali.rice.krad.util.MessageMap getMessageMap()
    • mergeErrorMap

      public static void mergeErrorMap(org.kuali.rice.krad.util.MessageMap messageMap)
      Merges a message map into the global variables error map
    • setMessageMap

      public static void setMessageMap(org.kuali.rice.krad.util.MessageMap messageMap)
      Sets a new (clean) MessageMap
    • getRequestCache

      public static Object getRequestCache(String cacheName)
    • setRequestCache

      public static void setRequestCache(String cacheName, Object cacheObject)
    • getUifFormManager

      public static UifFormManager getUifFormManager()
      Retrieves the UifFormManager which can be used to store and remove forms from the session
      Returns:
      UifFormManager
    • setUifFormManager

      public static void setUifFormManager(UifFormManager uifFormManager)
      Sets a UifFormManager for the current thread
    • getAuditErrorMap

      public static Map<String,AuditCluster> getAuditErrorMap()
      Returns:
      ArrayList containing audit error messages.
    • setAuditErrorMap

      public static void setAuditErrorMap(HashMap<String,AuditCluster> errorMap)
      Sets a new (clean) AuditErrorList
    • clear

      public static void clear()
      Clears out GlobalVariable objects with the exception of the UserSession
    • doInNewGlobalVariables

      public static <T> T doInNewGlobalVariables(Callable<T> callable) throws Exception
      Pushes a new GlobalVariables object onto the ThreadLocal GlobalVariables stack, invokes the runnable, and pops the GlobalVariables off in a finally clause
      Type Parameters:
      T - callable return type
      Parameters:
      callable - the code to run under a new set of GlobalVariables
      Returns:
      return value from callable
      Throws:
      Exception - from Callable.call()
    • doInNewGlobalVariables

      public static <T> T doInNewGlobalVariables(org.kuali.rice.krad.UserSession userSession, Callable<T> callable) throws Exception
      Convenience method that creates a new GlobalVariables stack frame, initialized with the provided UserSession (which may be the previous UserSession).
      Type Parameters:
      T - callable return type
      Parameters:
      userSession - the UserSession to initialize the new frame with (may be null)
      callable - the code to run under a new set of GlobalVariables
      Returns:
      return value from callable
      Throws:
      Exception - from Callable.call()