| 1 |
|
package liquibase.database.structure; |
| 2 |
|
|
| 3 |
|
import liquibase.database.Database; |
| 4 |
|
|
| 5 |
|
import java.util.ArrayList; |
| 6 |
|
import java.util.List; |
| 7 |
|
|
|
|
|
| 0% |
Uncovered Elements: 59 (59) |
Complexity: 24 |
Complexity Density: 0.75 |
|
| 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 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 19 |
0
|
public Table(String name) {... |
| 20 |
0
|
this.name = name; |
| 21 |
|
} |
| 22 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 23 |
0
|
public String getName() {... |
| 24 |
0
|
return name; |
| 25 |
|
} |
| 26 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 27 |
0
|
public Database getDatabase() {... |
| 28 |
0
|
return database; |
| 29 |
|
} |
| 30 |
|
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 2 |
Complexity Density: 0.67 |
|
| 31 |
0
|
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 |
|
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 40 |
0
|
public Table setDatabase(Database database) {... |
| 41 |
0
|
this.database = database; |
| 42 |
|
|
| 43 |
0
|
return this; |
| 44 |
|
} |
| 45 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 46 |
0
|
public String getRemarks() {... |
| 47 |
0
|
return remarks; |
| 48 |
|
} |
| 49 |
|
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 50 |
0
|
public Table setRemarks(String remarks) {... |
| 51 |
0
|
this.remarks = remarks; |
| 52 |
|
|
| 53 |
0
|
return this; |
| 54 |
|
} |
| 55 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 56 |
0
|
public List<Column> getColumns() {... |
| 57 |
0
|
return columns; |
| 58 |
|
} |
| 59 |
|
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 4 |
Complexity Density: 0.67 |
|
| 60 |
0
|
@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 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 73 |
0
|
@Override... |
| 74 |
|
public int hashCode() { |
| 75 |
0
|
return name.toUpperCase().hashCode(); |
| 76 |
|
} |
| 77 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 78 |
0
|
public int compareTo(Table o) {... |
| 79 |
0
|
return this.getName().compareToIgnoreCase(o.getName()); |
| 80 |
|
} |
| 81 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 82 |
0
|
@Override... |
| 83 |
|
public String toString() { |
| 84 |
0
|
return getName(); |
| 85 |
|
} |
| 86 |
|
|
| 87 |
|
|
| 88 |
|
|
| 89 |
|
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
| 90 |
0
|
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 |
| 101 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 102 |
0
|
public String getSchema() {... |
| 103 |
0
|
return schema; |
| 104 |
|
} |
| 105 |
|
|
| 106 |
|
|
| 107 |
|
@param |
| 108 |
|
|
| 109 |
|
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
| 110 |
0
|
public Table setSchema(String schema) {... |
| 111 |
0
|
this.schema = schema; |
| 112 |
|
|
| 113 |
0
|
return this; |
| 114 |
|
} |
| 115 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 116 |
0
|
public String getRawCatalogName() {... |
| 117 |
0
|
return rawCatalogName; |
| 118 |
|
} |
| 119 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 120 |
0
|
public void setRawCatalogName(String rawCatalogName) {... |
| 121 |
0
|
this.rawCatalogName = rawCatalogName; |
| 122 |
|
} |
| 123 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 124 |
0
|
public String getRawSchemaName() {... |
| 125 |
0
|
return rawSchemaName; |
| 126 |
|
} |
| 127 |
|
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 128 |
0
|
public void setRawSchemaName(String rawSchemaName) {... |
| 129 |
0
|
this.rawSchemaName = rawSchemaName; |
| 130 |
|
} |
| 131 |
|
} |