Coverage Report - org.kuali.rice.kew.util.ConfigStringLookup
 
Classes in this File Line Coverage Branch Coverage Complexity
ConfigStringLookup
0%
0/15
0%
0/8
2.667
 
 1  
 /*
 2  
  * Copyright 2005-2008 The Kuali Foundation
 3  
  *
 4  
  *
 5  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 6  
  * you may not use this file except in compliance with the License.
 7  
  * You may obtain a copy of the License at
 8  
  *
 9  
  * http://www.opensource.org/licenses/ecl2.php
 10  
  *
 11  
  * Unless required by applicable law or agreed to in writing, software
 12  
  * distributed under the License is distributed on an "AS IS" BASIS,
 13  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  * See the License for the specific language governing permissions and
 15  
  * limitations under the License.
 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  
  * Looks up Strings from the Config and System Parameters.
 27  
  *
 28  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 29  
  */
 30  
 public class ConfigStringLookup extends StrLookup {
 31  
         private String namespace;
 32  
         
 33  0
         public ConfigStringLookup() {
 34  
                 
 35  0
         }
 36  
         
 37  0
         public ConfigStringLookup(String namespace) {
 38  0
                 this.namespace = namespace;
 39  0
         }
 40  
         
 41  
         @Override
 42  
         public String lookup(String propertyName) {
 43  0
                 if (StringUtils.isBlank(propertyName)) {
 44  0
                         return null;
 45  
                 }
 46  
                 
 47  0
                 String paramValue = null;
 48  
                 
 49  
                 // TODO temporarily disabling configuration parameter resolution against the racms because it's been causing some issues
 50  0
                 if ( namespace != null ) {
 51  0
                         paramValue = KNSServiceLocator.getRiceApplicationConfigurationMediationService().getConfigurationParameter(namespace, propertyName);
 52  
                 }
 53  
                 
 54  
                 // check system parameters first
 55  0
                 if ( paramValue == null ) {
 56  0
                         paramValue = Utilities.getKNSParameterValue(KEWConstants.KEW_NAMESPACE, KNSConstants.DetailTypes.ALL_DETAIL_TYPE, propertyName);
 57  
                 }
 58  0
                 if (paramValue == null) {
 59  0
                         paramValue = ConfigContext.getCurrentContextConfig().getProperty(propertyName);
 60  
                 }
 61  0
                 return paramValue;
 62  
         }
 63  
 
 64  
 }