01: package liquibase.database.structure;
02:
03: import liquibase.database.Database;
04:
05: import java.util.ArrayList;
06: import java.util.List;
07:
08: public class View implements DatabaseObject, Comparable<View> {
09: private Database database;
10: private String name;
11: private List<Column> columns = new ArrayList<Column>();
12: private String definition;
13:
14: public View(String name) {
15: this .name = name;
16: }
17:
18: public View() {
19: }
20:
21: public Database getDatabase() {
22: return database;
23: }
24:
25: public void setDatabase(Database database) {
26: this .database = database;
27: }
28:
29: public String getName() {
30: return name;
31: }
32:
33: public void setName(String name) {
34: this .name = name;
35: }
36:
37: public List<Column> getColumns() {
38: return columns;
39: }
40:
41: public void addColumn(Column column) {
42: columns.add(column);
43: }
44:
45: public String getDefinition() {
46: return definition;
47: }
48:
49: public void setDefinition(String definition) {
50: this .definition = definition;
51: }
52:
53: public boolean equals(Object o) {
54: if (this == o)
55: return true;
56: if (o == null || getClass() != o.getClass())
57: return false;
58:
59: View view = (View) o;
60:
61: return name.equalsIgnoreCase(view.name);
62:
63: }
64:
65: public int hashCode() {
66: return name.toUpperCase().hashCode();
67: }
68:
69: public int compareTo(View o) {
70: return this .getName().compareTo(o.getName());
71: }
72:
73: public String toString() {
74: return getName();
75: }
76: }
|