01: /*
02: * Copyright 2005-2007 The Kuali Foundation.
03: *
04: * Licensed under the Educational Community License, Version 1.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.opensource.org/licenses/ecl1.php
09: *
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.core.datadictionary.exporter;
17:
18: import org.kuali.core.datadictionary.BusinessObjectEntry;
19:
20: /**
21: * BusinessObjectEntryMapper
22: */
23: public class BusinessObjectEntryMapper {
24:
25: /**
26: * Default constructor
27: */
28: public BusinessObjectEntryMapper() {
29: }
30:
31: /**
32: * @param entry
33: * @return Map containing a String- and Map-based representation of the given entry
34: */
35: public ExportMap mapEntry(BusinessObjectEntry entry) {
36: if (entry == null) {
37: throw new IllegalArgumentException("invalid (null) entry");
38: }
39:
40: ExportMap entryMap = new ExportMap(entry.getJstlKey());
41:
42: // simple properties
43: entryMap.set("businessObjectClass", entry
44: .getBusinessObjectClass().getName());
45: final String objectLabel = entry.getObjectLabel();
46: if (objectLabel != null) {
47: entryMap.set("objectLabel", objectLabel);
48: }
49: final String objectDescription = entry.getObjectDescription();
50: if (objectDescription != null) {
51: entryMap.set("objectDescription", objectDescription);
52: }
53:
54: // complex properties
55: entryMap.setOptional(new InquiryMapBuilder()
56: .buildInquiryMap(entry));
57: entryMap.setOptional(new LookupMapBuilder()
58: .buildLookupMap(entry));
59: entryMap.set(new AttributesMapBuilder()
60: .buildAttributesMap(entry));
61: entryMap.set(new CollectionsMapBuilder()
62: .buildCollectionsMap(entry));
63: entryMap.set(new RelationshipsMapBuilder()
64: .buildRelationshipsMap(entry));
65:
66: return entryMap;
67: }
68: }
|