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 2006-2011 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community License, Version 2.0 (the "License");
 5  
  * you may not use this file except in compliance with the License.
 6  
  * You may obtain a copy of the License at
 7  
  *
 8  
  * http://www.opensource.org/licenses/ecl2.php
 9  
  *
 10  
  * Unless required by applicable law or agreed to in writing, software
 11  
  * distributed under the License is distributed on an "AS IS" BASIS,
 12  
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 13  
  * See the License for the specific language governing permissions and
 14  
  * limitations under the License.
 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  
  * Looks up Strings from the Config and System Parameters.
 28  
  *
 29  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 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  
                 // TODO temporarily disabling configuration parameter resolution against the racms because it's been causing some issues
 52  0
                 if ( applicationId != null ) {
 53  0
                         paramValue = KRADServiceLocatorWeb.getRiceApplicationConfigurationMediationService().getConfigurationParameter(applicationId, propertyName);
 54  
                 }
 55  
                 
 56  
                 // check system parameters first
 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  
 }