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.api.config.property.ConfigContext; |
22 | |
import org.kuali.rice.core.framework.services.CoreFrameworkServiceLocator; |
23 | |
import org.kuali.rice.krad.service.KRADServiceLocatorWeb; |
24 | |
import org.kuali.rice.krad.util.KRADConstants; |
25 | |
|
26 | |
|
27 | |
|
28 | |
|
29 | |
|
30 | |
|
31 | |
public class ConfigStringLookup extends StrLookup { |
32 | |
|
33 | |
private String applicationId; |
34 | |
|
35 | 0 | public ConfigStringLookup() { |
36 | |
|
37 | 0 | } |
38 | |
|
39 | 0 | public ConfigStringLookup(String applicationId) { |
40 | 0 | this.applicationId = applicationId; |
41 | 0 | } |
42 | |
|
43 | |
@Override |
44 | |
public String lookup(String propertyName) { |
45 | 0 | if (StringUtils.isBlank(propertyName)) { |
46 | 0 | return null; |
47 | |
} |
48 | |
|
49 | 0 | String paramValue = null; |
50 | |
|
51 | |
|
52 | 0 | if ( applicationId != null ) { |
53 | 0 | paramValue = KRADServiceLocatorWeb.getRiceApplicationConfigurationMediationService().getConfigurationParameter(applicationId, propertyName); |
54 | |
} |
55 | |
|
56 | |
|
57 | 0 | if ( paramValue == null ) { |
58 | 0 | paramValue = CoreFrameworkServiceLocator.getParameterService().getParameterValueAsString(KEWConstants.KEW_NAMESPACE, KRADConstants.DetailTypes.ALL_DETAIL_TYPE, propertyName); |
59 | |
} |
60 | 0 | if (paramValue == null) { |
61 | 0 | paramValue = ConfigContext.getCurrentContextConfig().getProperty(propertyName); |
62 | |
} |
63 | 0 | return paramValue; |
64 | |
} |
65 | |
|
66 | |
} |