1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kns.web.struts.action;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.apache.struts.util.MessageResourcesFactory;
20 import org.apache.struts.util.PropertyMessageResources;
21
22 import java.util.HashMap;
23 import java.util.Map;
24 import java.util.Set;
25
26
27
28
29
30
31
32
33 @Deprecated
34 public class KualiPropertyMessageResources extends PropertyMessageResources {
35 private static final long serialVersionUID = -7712311580595112293L;
36 private HashMap kualiMessages;
37
38 public KualiPropertyMessageResources(MessageResourcesFactory factory, String config) {
39 super(factory, config);
40 }
41
42 public KualiPropertyMessageResources(MessageResourcesFactory factory, String config, boolean returnNull) {
43 super(factory, config, returnNull);
44 }
45
46 protected void loadLocale(String localeKey) {
47 String initialConfig = config;
48 String[] propertyFiles = config.split(",");
49 for (String propertyFile : propertyFiles) {
50 config = propertyFile;
51 locales.remove(localeKey);
52 super.loadLocale(localeKey);
53 }
54 config = initialConfig;
55 }
56
57 public Map getKualiProperties(String localeKey) {
58 if (this.kualiMessages != null && !this.kualiMessages.isEmpty()) {
59 return this.kualiMessages;
60 }
61 localeKey = (localeKey == null) ? "" : localeKey;
62 String localePrefix = localeKey + ".";
63
64 this.loadLocale((localeKey == null) ? "" : localeKey);
65 this.kualiMessages = new HashMap(this.messages.size());
66 Set<String> keys = this.messages.keySet();
67 for (String key : keys) {
68 this.kualiMessages.put(StringUtils.substringAfter(key, localePrefix), this.messages.get(key));
69 }
70 return this.kualiMessages;
71 }
72
73 }