View Javadoc
1   /**
2    * Copyright 2005-2016 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  /**
23   * @author Kuali Rice Team (rice.collab@kuali.org)
24   *
25   * @deprecated Only used in KNS classes, use KRAD.
26   */
27  @Deprecated
28  public final class KNSGlobalVariables {
29  
30      private KNSGlobalVariables() {
31          throw new UnsupportedOperationException("do not call");
32      }
33  
34      private static ThreadLocal<KualiForm> kualiForms = new ApplicationThreadLocal<KualiForm>();
35  
36      private static ThreadLocal<MessageList> messageLists = new ApplicationThreadLocal<MessageList>() {
37          @Override
38          protected MessageList initialValue() {
39              return new MessageList();
40          }
41      };
42  
43      /**
44       * @return ArrayList containing messages.
45       */
46      @Deprecated
47      public static MessageList getMessageList() {
48          return messageLists.get();
49      }
50  
51      /**
52       * Sets a new message list
53       *
54       * @param messageList
55       */
56      @Deprecated
57      public static void setMessageList(MessageList messageList) {
58          messageLists.set(messageList);
59      }
60  
61      /**
62       * @return KualiForm that has been assigned to this thread of execution.
63       */
64      @Deprecated
65      public static KualiForm getKualiForm() {
66          return kualiForms.get();
67      }
68  
69      /**
70       * sets the kualiForm object into the global variable for this thread
71       *
72       * @param kualiForm
73       */
74      @Deprecated
75      public static void setKualiForm(KualiForm kualiForm) {
76          kualiForms.set(kualiForm);
77      }
78  
79      @Deprecated
80      public static void clear() {
81          GlobalVariables.clear();
82          messageLists.set(new MessageList());
83          kualiForms.set(null);
84      }
85  }