1 | |
|
2 | |
|
3 | |
|
4 | |
|
5 | |
|
6 | |
|
7 | |
|
8 | |
|
9 | |
|
10 | |
|
11 | |
|
12 | |
|
13 | |
|
14 | |
|
15 | |
|
16 | |
package org.kuali.rice.kns.datadictionary.exporter; |
17 | |
|
18 | |
import org.apache.commons.lang.StringUtils; |
19 | |
import org.kuali.rice.kns.datadictionary.BusinessObjectEntry; |
20 | |
import org.kuali.rice.krad.datadictionary.DataDictionaryEntry; |
21 | |
import org.kuali.rice.kns.datadictionary.MaintenanceDocumentEntry; |
22 | |
import org.kuali.rice.kns.datadictionary.TransactionalDocumentEntry; |
23 | |
import org.kuali.rice.krad.service.DataDictionaryService; |
24 | |
import org.kuali.rice.krad.service.KRADServiceLocatorWeb; |
25 | |
|
26 | |
import java.util.HashMap; |
27 | |
import java.util.Map; |
28 | |
|
29 | |
@Deprecated |
30 | |
public class DataDictionaryMap extends DataDictionaryMapBase { |
31 | |
|
32 | |
private DataDictionaryService dataDictionaryService; |
33 | |
|
34 | 0 | BusinessObjectEntryMapper boMapper = new BusinessObjectEntryMapper(); |
35 | 0 | MaintenanceDocumentEntryMapper maintDocMapper = new MaintenanceDocumentEntryMapper(); |
36 | 0 | TransactionalDocumentEntryMapper transDocMapper = new TransactionalDocumentEntryMapper(); |
37 | |
|
38 | 0 | Map<String,Map> ddMap = new HashMap<String,Map>(); |
39 | |
|
40 | |
public DataDictionaryMap(DataDictionaryService dataDictionaryService) { |
41 | 0 | super(); |
42 | 0 | this.dataDictionaryService = dataDictionaryService; |
43 | 0 | } |
44 | |
|
45 | |
public Object get(Object key) { |
46 | 0 | Map subMap = ddMap.get( key ); |
47 | 0 | if ( subMap == null ) { |
48 | 0 | synchronized( this ) { |
49 | 0 | subMap = ddMap.get( key ); |
50 | 0 | if ( subMap == null ) { |
51 | 0 | DataDictionaryEntry entry = KRADServiceLocatorWeb.getDataDictionaryService().getDataDictionary().getDictionaryObjectEntry( key.toString() ); |
52 | |
|
53 | 0 | if ( entry == null && key.toString().contains(".")) { |
54 | 0 | entry = dataDictionaryService.getDataDictionary().getDictionaryObjectEntry( StringUtils.substringAfterLast( key.toString(), "." ) ); |
55 | |
} |
56 | 0 | if ( entry != null ) { |
57 | 0 | if ( entry instanceof BusinessObjectEntry ) { |
58 | 0 | subMap = boMapper.mapEntry( (BusinessObjectEntry)entry ).getExportData(); |
59 | 0 | } else if ( entry instanceof MaintenanceDocumentEntry ) { |
60 | 0 | subMap = maintDocMapper.mapEntry( (MaintenanceDocumentEntry)entry ).getExportData(); |
61 | 0 | } else if ( entry instanceof TransactionalDocumentEntry ) { |
62 | 0 | subMap = transDocMapper.mapEntry( (TransactionalDocumentEntry)entry ).getExportData(); |
63 | |
} |
64 | |
} |
65 | 0 | if ( subMap != null ) { |
66 | 0 | ddMap.put( key.toString(), subMap ); |
67 | |
} |
68 | |
} |
69 | 0 | } |
70 | |
} |
71 | 0 | return subMap; |
72 | |
} |
73 | |
|
74 | |
public DataDictionaryService getDataDictionaryService() { |
75 | 0 | return dataDictionaryService; |
76 | |
} |
77 | |
|
78 | |
public void setDataDictionaryService(DataDictionaryService dataDictionaryService) { |
79 | 0 | this.dataDictionaryService = dataDictionaryService; |
80 | 0 | } |
81 | |
|
82 | |
} |