1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.common.impex.model;
17
18 import java.util.ArrayList;
19 import java.util.List;
20
21 import javax.xml.bind.annotation.XmlAccessType;
22 import javax.xml.bind.annotation.XmlAccessorType;
23 import javax.xml.bind.annotation.XmlElement;
24 import javax.xml.bind.annotation.XmlRootElement;
25
26 import org.kuali.common.util.CollectionUtils;
27
28 @XmlRootElement
29 @XmlAccessorType(XmlAccessType.PROPERTY)
30 public class Schema {
31
32 String name;
33 List<Table> tables = new ArrayList<Table>();
34 List<Sequence> sequences = new ArrayList<Sequence>();
35 List<View> views = new ArrayList<View>();
36 List<ForeignKey> foreignKeys = new ArrayList<ForeignKey>();
37
38
39
40
41 public Schema(Schema schema) {
42 super();
43 this.name = schema.getName();
44
45 for (Table table : CollectionUtils.toEmptyList(schema.getTables())) {
46 this.tables.add(new Table(table));
47 }
48
49 for (Sequence sequence : CollectionUtils.toEmptyList(schema.getSequences())) {
50 this.sequences.add(new Sequence(sequence));
51 }
52
53 for (View view : CollectionUtils.toEmptyList(schema.getViews())) {
54 this.views.add(new View(view));
55 }
56
57 for (ForeignKey fk : CollectionUtils.toEmptyList(schema.getForeignKeys())) {
58 this.foreignKeys.add(new ForeignKey(fk));
59 }
60 }
61
62 public Schema() {
63 super();
64 }
65
66 @XmlElement
67 public String getName() {
68 return name;
69 }
70
71 @XmlElement(name = "table")
72 public List<Table> getTables() {
73 return tables;
74 }
75
76 @XmlElement(name = "foreignKey")
77 public List<ForeignKey> getForeignKeys() {
78 return foreignKeys;
79 }
80
81 @XmlElement(name = "sequence")
82 public List<Sequence> getSequences() {
83 return sequences;
84 }
85
86 @XmlElement(name = "view")
87 public List<View> getViews() {
88 return views;
89 }
90
91 public void setName(String name) {
92 this.name = name;
93 }
94
95 public void setForeignKeys(List<ForeignKey> foreignKeys) {
96 this.foreignKeys = foreignKeys;
97 }
98
99 public void setSequences(List<Sequence> sequences) {
100 this.sequences = sequences;
101 }
102
103 public void setTables(List<Table> tables) {
104 this.tables = tables;
105 }
106
107 public void setViews(List<View> views) {
108 this.views = views;
109 }
110 }