Clover Coverage Report - Liquibase Core 2.0.2
Coverage timestamp: Wed Aug 3 2011 19:29:16 EDT
../../../img/srcFileCovDistChart0.png 69% of files have more coverage
32   131   24   1.68
8   90   0.75   19
19     1.26  
1    
 
  Table       Line # 8 32 0% 24 59 0% 0.0
 
No Tests
 
1    package liquibase.database.structure;
2   
3    import liquibase.database.Database;
4   
5    import java.util.ArrayList;
6    import java.util.List;
7   
 
8    public class Table implements DatabaseObject, Comparable<Table> {
9   
10    private Database database;
11    private String name;
12    private String remarks;
13    private String schema;
14    private List<Column> columns = new ArrayList<Column>();
15   
16    private String rawCatalogName;
17    private String rawSchemaName;
18   
 
19  0 toggle public Table(String name) {
20  0 this.name = name;
21    }
22   
 
23  0 toggle public String getName() {
24  0 return name;
25    }
26   
 
27  0 toggle public Database getDatabase() {
28  0 return database;
29    }
30   
 
31  0 toggle public DatabaseObject[] getContainingObjects() {
32  0 if (getSchema() == null) {
33  0 return new DatabaseObject[] { getDatabase() };
34    } else {
35  0 return new DatabaseObject[] { new Schema(getSchema()) };
36    }
37   
38    }
39   
 
40  0 toggle public Table setDatabase(Database database) {
41  0 this.database = database;
42   
43  0 return this;
44    }
45   
 
46  0 toggle public String getRemarks() {
47  0 return remarks;
48    }
49   
 
50  0 toggle public Table setRemarks(String remarks) {
51  0 this.remarks = remarks;
52   
53  0 return this;
54    }
55   
 
56  0 toggle public List<Column> getColumns() {
57  0 return columns;
58    }
59   
 
60  0 toggle @Override
61    public boolean equals(Object o) {
62  0 if (this == o)
63  0 return true;
64  0 if (o == null || getClass() != o.getClass())
65  0 return false;
66   
67  0 Table that = (Table) o;
68   
69  0 return name.equalsIgnoreCase(that.name);
70   
71    }
72   
 
73  0 toggle @Override
74    public int hashCode() {
75  0 return name.toUpperCase().hashCode();
76    }
77   
 
78  0 toggle public int compareTo(Table o) {
79  0 return this.getName().compareToIgnoreCase(o.getName());
80    }
81   
 
82  0 toggle @Override
83    public String toString() {
84  0 return getName();
85    }
86   
87    /**
88    * Returns the column object for the given columnName. If the column does not exist in this table, return null.
89    */
 
90  0 toggle public Column getColumn(String columnName) {
91  0 for (Column column : getColumns()) {
92  0 if (column.getName().equalsIgnoreCase(columnName)) {
93  0 return column;
94    }
95    }
96  0 return null;
97    }
98   
99    /**
100    * @return Returns the schema.
101    */
 
102  0 toggle public String getSchema() {
103  0 return schema;
104    }
105   
106    /**
107    * @param schema
108    * The schema to set.
109    */
 
110  0 toggle public Table setSchema(String schema) {
111  0 this.schema = schema;
112   
113  0 return this;
114    }
115   
 
116  0 toggle public String getRawCatalogName() {
117  0 return rawCatalogName;
118    }
119   
 
120  0 toggle public void setRawCatalogName(String rawCatalogName) {
121  0 this.rawCatalogName = rawCatalogName;
122    }
123   
 
124  0 toggle public String getRawSchemaName() {
125  0 return rawSchemaName;
126    }
127   
 
128  0 toggle public void setRawSchemaName(String rawSchemaName) {
129  0 this.rawSchemaName = rawSchemaName;
130    }
131    }