Package org.kuali.rice.krad.util
Class GlobalVariables
java.lang.Object
org.kuali.rice.krad.util.GlobalVariables
Holds all of our thread local variables and accessors for those
- Author:
- Kuali Rice Team (rice.collab@kuali.org)
-
Method Summary
Modifier and TypeMethodDescriptionstatic voidclear()Clears out GlobalVariable objects with the exception of the UserSessionstatic <T> TdoInNewGlobalVariables(Callable<T> callable) Pushes a new GlobalVariables object onto the ThreadLocal GlobalVariables stack, invokes the runnable, and pops the GlobalVariables off in a finally clausestatic <T> TdoInNewGlobalVariables(UserSession userSession, Callable<T> callable) Convenience method that creates a new GlobalVariables stack frame, initialized with the provided UserSession (which may be the previous UserSession).static Map<String, AuditCluster> static GlobalVariablesstatic MessageMapstatic ObjectgetRequestCache(String cacheName) static UifFormManagerRetrieves theUifFormManagerwhich can be used to store and remove forms from the sessionstatic UserSessionstatic voidinjectGlobalVariables(GlobalVariables globalVariables) static voidmergeErrorMap(MessageMap messageMap) Merges a message map into the global variables error mapstatic GlobalVariablesstatic voidsetAuditErrorMap(HashMap<String, AuditCluster> errorMap) Sets a new (clean) AuditErrorListstatic voidsetHideSessionFromTestsMessage(String message) Sets an error message for tests that try to use the session without declaring it.static voidsetMessageMap(MessageMap messageMap) Sets a new (clean) MessageMapstatic voidsetRequestCache(String cacheName, Object cacheObject) static voidsetUifFormManager(UifFormManager uifFormManager) Sets aUifFormManagerfor the current threadstatic voidsetUserSession(UserSession userSession) sets the userSession object into the global variable for this thread
-
Method Details
-
getCurrentGlobalVariables
-
injectGlobalVariables
-
popGlobalVariables
-
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
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
sets the userSession object into the global variable for this thread -
getMessageMap
-
mergeErrorMap
Merges a message map into the global variables error map -
setMessageMap
Sets a new (clean) MessageMap -
getRequestCache
-
setRequestCache
-
getUifFormManager
Retrieves theUifFormManagerwhich can be used to store and remove forms from the session- Returns:
- UifFormManager
-
setUifFormManager
Sets aUifFormManagerfor the current thread -
getAuditErrorMap
- Returns:
- ArrayList containing audit error messages.
-
setAuditErrorMap
Sets a new (clean) AuditErrorList -
clear
public static void clear()Clears out GlobalVariable objects with the exception of the UserSession -
doInNewGlobalVariables
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- fromCallable.call()
-
doInNewGlobalVariables
public static <T> T doInNewGlobalVariables(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- fromCallable.call()
-