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