1
2
3
4
5
6
7
8
9
10
11
12
13
14
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
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 KRADServiceLocatorWeb.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 }