1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.kns.datadictionary.spring;
17
18 import java.util.List;
19
20 import org.kuali.rice.core.config.ConfigurationException;
21 import org.kuali.rice.kns.service.DataDictionaryService;
22 import org.kuali.rice.kns.service.KNSServiceLocator;
23 import org.springframework.beans.factory.InitializingBean;
24
25
26
27
28
29
30 public class DataDictionaryLocationConfigurer implements InitializingBean {
31
32 private List<String> dataDictionaryPackages;
33
34 private DataDictionaryService dataDictionaryService;
35
36 public DataDictionaryLocationConfigurer(DataDictionaryService dataDictionaryService){
37 this.dataDictionaryService = dataDictionaryService;
38 }
39
40 public void afterPropertiesSet() throws Exception {
41 if (dataDictionaryPackages == null || dataDictionaryPackages.isEmpty()) {
42 throw new ConfigurationException("datatDictionaryPackages empty when initializing DataDictionaryLocation bean.");
43 }
44 if(dataDictionaryService!=null)
45 dataDictionaryService.addDataDictionaryLocations(getDataDictionaryPackages());
46 else
47 KNSServiceLocator.getDataDictionaryService().addDataDictionaryLocations(getDataDictionaryPackages());
48 }
49
50 public List<String> getDataDictionaryPackages() {
51 return dataDictionaryPackages;
52 }
53
54 public void setDataDictionaryPackages(List<String> dataDictionaryPackages) {
55 this.dataDictionaryPackages = dataDictionaryPackages;
56 }
57
58 }