1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.kuali.rice.kew.util;
18
19 import org.apache.commons.lang.StringUtils;
20 import org.apache.commons.lang.text.StrLookup;
21 import org.kuali.rice.core.config.ConfigContext;
22 import org.kuali.rice.kns.service.KNSServiceLocator;
23 import org.kuali.rice.kns.util.KNSConstants;
24
25
26
27
28
29
30 public class ConfigStringLookup extends StrLookup {
31 private String namespace;
32
33 public ConfigStringLookup() {
34
35 }
36
37 public ConfigStringLookup(String namespace) {
38 this.namespace = namespace;
39 }
40
41 @Override
42 public String lookup(String propertyName) {
43 if (StringUtils.isBlank(propertyName)) {
44 return null;
45 }
46
47 String paramValue = null;
48
49
50 if ( namespace != null ) {
51 paramValue = KNSServiceLocator.getRiceApplicationConfigurationMediationService().getConfigurationParameter(namespace, propertyName);
52 }
53
54
55 if ( paramValue == null ) {
56 paramValue = Utilities.getKNSParameterValue(KEWConstants.KEW_NAMESPACE, KNSConstants.DetailTypes.ALL_DETAIL_TYPE, propertyName);
57 }
58 if (paramValue == null) {
59 paramValue = ConfigContext.getCurrentContextConfig().getProperty(propertyName);
60 }
61 return paramValue;
62 }
63
64 }