Coverage Report - org.kuali.rice.krad.datadictionary.DataDictionaryLocationConfigurer
 
Classes in this File Line Coverage Branch Coverage Complexity
DataDictionaryLocationConfigurer
0%
0/12
0%
0/6
2
 
 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.krad.datadictionary;
 18  
 
 19  
 import org.kuali.rice.core.api.config.ConfigurationException;
 20  
 import org.kuali.rice.krad.service.DataDictionaryService;
 21  
 import org.kuali.rice.krad.service.KRADServiceLocatorWeb;
 22  
 import org.springframework.beans.factory.InitializingBean;
 23  
 
 24  
 import java.util.List;
 25  
 
 26  
 /**
 27  
  * Puts a data dictionary file location in the data dictionary
 28  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 29  
  *
 30  
  */
 31  
 public class DataDictionaryLocationConfigurer implements InitializingBean {
 32  
 
 33  
         private List<String> dataDictionaryPackages;
 34  
         
 35  
         private DataDictionaryService dataDictionaryService;
 36  
         
 37  0
         public DataDictionaryLocationConfigurer(DataDictionaryService dataDictionaryService){
 38  0
                 this.dataDictionaryService = dataDictionaryService;
 39  0
         }
 40  
         
 41  
         public void afterPropertiesSet() throws Exception {
 42  0
                 if (dataDictionaryPackages == null || dataDictionaryPackages.isEmpty()) {
 43  0
                         throw new ConfigurationException("datatDictionaryPackages empty when initializing DataDictionaryLocation bean.");
 44  
                 }
 45  0
                 if(dataDictionaryService!=null)
 46  0
                         dataDictionaryService.addDataDictionaryLocations(getDataDictionaryPackages());
 47  
                 else
 48  0
                         KRADServiceLocatorWeb.getDataDictionaryService().addDataDictionaryLocations(getDataDictionaryPackages());
 49  0
         }
 50  
 
 51  
         public List<String> getDataDictionaryPackages() {
 52  0
                 return dataDictionaryPackages;
 53  
         }
 54  
 
 55  
         public void setDataDictionaryPackages(List<String> dataDictionaryPackages) {
 56  0
                 this.dataDictionaryPackages = dataDictionaryPackages;
 57  0
         }
 58  
 
 59  
 }