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
30
31
32 @Deprecated
33 public class DataDictionaryMap extends DataDictionaryMapBase {
34
35 private DataDictionaryService dataDictionaryService;
36
37 BusinessObjectEntryMapper boMapper = new BusinessObjectEntryMapper();
38 MaintenanceDocumentEntryMapper maintDocMapper = new MaintenanceDocumentEntryMapper();
39 TransactionalDocumentEntryMapper transDocMapper = new TransactionalDocumentEntryMapper();
40
41 Map<String,Map> ddMap = new HashMap<String,Map>();
42
43 public DataDictionaryMap(DataDictionaryService dataDictionaryService) {
44 super();
45 this.dataDictionaryService = dataDictionaryService;
46 }
47
48 public Object get(Object key) {
49 Map subMap = ddMap.get( key );
50 if ( subMap == null ) {
51 synchronized( this ) {
52 subMap = ddMap.get( key );
53 if ( subMap == null ) {
54 DataDictionaryEntry entry = KRADServiceLocatorWeb.getDataDictionaryService().getDataDictionary().getDictionaryObjectEntry( key.toString() );
55
56 if ( entry == null && key.toString().contains(".")) {
57 entry = dataDictionaryService.getDataDictionary().getDictionaryObjectEntry( StringUtils.substringAfterLast( key.toString(), "." ) );
58 }
59 if ( entry != null ) {
60 if ( entry instanceof BusinessObjectEntry ) {
61 subMap = boMapper.mapEntry( (BusinessObjectEntry)entry ).getExportData();
62 } else if ( entry instanceof MaintenanceDocumentEntry ) {
63 subMap = maintDocMapper.mapEntry( (MaintenanceDocumentEntry)entry ).getExportData();
64 } else if ( entry instanceof TransactionalDocumentEntry ) {
65 subMap = transDocMapper.mapEntry( (TransactionalDocumentEntry)entry ).getExportData();
66 }
67 }
68 if ( subMap != null ) {
69 ddMap.put( key.toString(), subMap );
70 }
71 }
72 }
73 }
74 return subMap;
75 }
76
77 public DataDictionaryService getDataDictionaryService() {
78 return dataDictionaryService;
79 }
80
81 public void setDataDictionaryService(DataDictionaryService dataDictionaryService) {
82 this.dataDictionaryService = dataDictionaryService;
83 }
84
85 }