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.kuali.rice.krad.datadictionary.DataDictionaryEntryBase;
19 import org.kuali.rice.krad.datadictionary.PrimitiveAttributeDefinition;
20 import org.kuali.rice.krad.datadictionary.RelationshipDefinition;
21 import org.kuali.rice.krad.datadictionary.exporter.ExportMap;
22
23
24
25
26
27
28 @Deprecated
29 public class RelationshipsMapBuilder {
30
31
32
33
34 public RelationshipsMapBuilder() {
35 }
36
37
38
39
40
41
42 public ExportMap buildRelationshipsMap(DataDictionaryEntryBase entry) {
43 ExportMap relationshipsMap = new ExportMap("relationships");
44
45 for ( RelationshipDefinition relationship : entry.getRelationships() ) {
46 relationshipsMap.set(buildRelationshipMap(relationship));
47 }
48
49 return relationshipsMap;
50 }
51
52 private ExportMap buildRelationshipMap(RelationshipDefinition relationship) {
53 ExportMap relationshipMap = new ExportMap(relationship.getObjectAttributeName());
54
55 ExportMap attributesMap = new ExportMap("primitiveAttributes");
56
57 int count = 0;
58 for (PrimitiveAttributeDefinition primitiveAttributeDefinition : relationship.getPrimitiveAttributes()) {
59 ExportMap attributeMap = new ExportMap(Integer.toString(count++));
60 attributeMap.set("sourceName", primitiveAttributeDefinition.getSourceName());
61 attributeMap.set("targetName", primitiveAttributeDefinition.getTargetName());
62
63 attributesMap.set(attributeMap);
64 }
65
66 relationshipMap.set(attributesMap);
67
68 return relationshipMap;
69 }
70
71 }