1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kew.util;
17
18 import org.apache.commons.lang.StringUtils;
19 import org.apache.commons.lang.text.StrLookup;
20 import org.kuali.rice.core.api.CoreApiServiceLocator;
21 import org.kuali.rice.core.api.config.property.ConfigContext;
22 import org.kuali.rice.core.api.parameter.ParameterKey;
23 import org.kuali.rice.core.framework.services.CoreFrameworkServiceLocator;
24 import org.kuali.rice.kew.api.KewApiConstants;
25 import org.kuali.rice.kim.api.KimConstants;
26 import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
27 import org.kuali.rice.krad.util.KRADConstants;
28
29
30
31
32
33
34 public class ConfigStringLookup extends StrLookup {
35
36 private final String applicationId;
37
38 public ConfigStringLookup() {
39 this(null);
40 }
41
42 public ConfigStringLookup(String applicationId) {
43 this.applicationId = applicationId;
44 }
45
46 @Override
47 public String lookup(String propertyName) {
48 if (StringUtils.isBlank(propertyName)) {
49 return null;
50 }
51
52 String paramValue = null;
53
54 if (StringUtils.isBlank(applicationId)) {
55 paramValue = CoreFrameworkServiceLocator.getParameterService().getParameterValueAsString(
56 KewApiConstants.KEW_NAMESPACE, KRADConstants.DetailTypes.ALL_DETAIL_TYPE, propertyName);
57 } else {
58 ParameterKey parameterKey = ParameterKey.create(applicationId, KewApiConstants.KEW_NAMESPACE,
59 KRADConstants.DetailTypes.ALL_DETAIL_TYPE, propertyName);
60 paramValue = CoreApiServiceLocator.getParameterRepositoryService().getParameterValueAsString(parameterKey);
61 }
62
63 if (paramValue == null) {
64 paramValue = ConfigContext.getCurrentContextConfig().getProperty(propertyName);
65 }
66 return paramValue;
67 }
68
69 }