View Javadoc

1   /**
2    * Copyright 2005-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.kns.util;
17  
18  import org.kuali.rice.core.framework.util.ApplicationThreadLocal;
19  import org.kuali.rice.kns.web.struts.form.KualiForm;
20  import org.kuali.rice.krad.util.GlobalVariables;
21  
22  import java.util.HashMap;
23  import java.util.Map;
24  
25  /**
26   * @author Kuali Rice Team (rice.collab@kuali.org)
27   */
28  @Deprecated
29  public final class KNSGlobalVariables {
30  
31      private KNSGlobalVariables() {
32          throw new UnsupportedOperationException("do not call");
33      }
34  
35      private static ThreadLocal<KualiForm> kualiForms = new ApplicationThreadLocal<KualiForm>();
36  
37      private static ThreadLocal<MessageList> messageLists = new ApplicationThreadLocal<MessageList>() {
38          @Override
39          protected MessageList initialValue() {
40              return new MessageList();
41          }
42      };
43  
44      private static ThreadLocal<HashMap<String, AuditCluster>> auditErrorMaps = new ApplicationThreadLocal<HashMap<String, AuditCluster>>() {
45      	@Override
46      	protected HashMap<String, AuditCluster> initialValue() {
47      		return new HashMap<String, AuditCluster>();
48      	}
49      };
50  
51      /**
52       * @return ArrayList containing messages.
53       */
54      @Deprecated
55      public static MessageList getMessageList() {
56          return messageLists.get();
57      }
58  
59      /**
60       * Sets a new message list
61       *
62       * @param messageList
63       */
64      @Deprecated
65      public static void setMessageList(MessageList messageList) {
66          messageLists.set(messageList);
67      }
68  
69      /**
70       * @return KualiForm that has been assigned to this thread of execution.
71       */
72      @Deprecated
73      public static KualiForm getKualiForm() {
74          return kualiForms.get();
75      }
76  
77      /**
78       * @return ArrayList containing audit error messages.
79       */
80      @Deprecated
81      public static Map<String, AuditCluster> getAuditErrorMap() {
82          return auditErrorMaps.get();
83      }
84  
85      /**
86       * Sets a new (clean) AuditErrorList
87       *
88       * @param errorMap
89       */
90      @Deprecated
91      public static void setAuditErrorMap(HashMap<String, AuditCluster> errorMap) {
92          auditErrorMaps.set(errorMap);
93      }
94  
95      /**
96       * sets the kualiForm object into the global variable for this thread
97       *
98       * @param kualiForm
99       */
100     @Deprecated
101     public static void setKualiForm(KualiForm kualiForm) {
102         kualiForms.set(kualiForm);
103     }
104 
105     @Deprecated
106     public static void clear() {
107         GlobalVariables.clear();
108         messageLists.set(new MessageList());
109         auditErrorMaps.set(new HashMap<String, AuditCluster>());
110         kualiForms.set(null);
111     }
112 }