1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package com.xpn.xwiki.store; |
21 |
|
|
22 |
|
|
23 |
|
@link |
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
@version |
31 |
|
|
|
|
| 78.2% |
Uncovered Elements: 12 (55) |
Complexity: 17 |
Complexity Density: 0.59 |
|
32 |
|
public final class DatabaseProduct |
33 |
|
{ |
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
public static final DatabaseProduct ORACLE = new DatabaseProduct("Oracle"); |
38 |
|
|
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
public static final DatabaseProduct DERBY = new DatabaseProduct("Apache Derby"); |
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
public static final DatabaseProduct HSQLDB = new DatabaseProduct("HSQL Database Engine"); |
48 |
|
|
49 |
|
|
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
@link |
55 |
|
|
56 |
|
@link |
57 |
|
@link |
58 |
|
|
59 |
|
|
60 |
|
public static final DatabaseProduct DB2 = new DatabaseProduct("DB2/"); |
61 |
|
|
62 |
|
|
63 |
|
|
64 |
|
|
65 |
|
public static final DatabaseProduct MYSQL = new DatabaseProduct("MySQL"); |
66 |
|
|
67 |
|
|
68 |
|
|
69 |
|
|
70 |
|
public static final DatabaseProduct POSTGRESQL = new DatabaseProduct("PostgreSQL"); |
71 |
|
|
72 |
|
|
73 |
|
|
74 |
|
|
75 |
|
public static final DatabaseProduct MSSQL = new DatabaseProduct("Microsoft SQL Server"); |
76 |
|
|
77 |
|
|
78 |
|
|
79 |
|
|
80 |
|
public static final DatabaseProduct UNKNOWN = new DatabaseProduct("Unknown"); |
81 |
|
|
82 |
|
|
83 |
|
|
84 |
|
|
85 |
|
public static final DatabaseProduct H2 = new DatabaseProduct("H2"); |
86 |
|
|
87 |
|
|
88 |
|
@see |
89 |
|
|
90 |
|
private String productName; |
91 |
|
|
92 |
|
|
93 |
|
|
94 |
|
|
95 |
|
@param |
96 |
|
@link |
97 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
98 |
369 |
private DatabaseProduct(String productName)... |
99 |
|
{ |
100 |
369 |
this.productName = productName; |
101 |
|
} |
102 |
|
|
103 |
|
|
104 |
|
@return |
105 |
|
@link |
106 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
107 |
378291 |
public String getProductName()... |
108 |
|
{ |
109 |
378288 |
return this.productName; |
110 |
|
} |
111 |
|
|
|
|
| 80% |
Uncovered Elements: 2 (10) |
Complexity: 4 |
Complexity Density: 0.67 |
|
112 |
6 |
@Override... |
113 |
|
public boolean equals(Object object) |
114 |
|
{ |
115 |
6 |
boolean result = false; |
116 |
6 |
if ((object != null) && (object instanceof DatabaseProduct)) { |
117 |
6 |
DatabaseProduct product = (DatabaseProduct) object; |
118 |
6 |
if (product.getProductName().equals(getProductName())) { |
119 |
6 |
result = true; |
120 |
|
} |
121 |
|
} |
122 |
|
|
123 |
6 |
return result; |
124 |
|
} |
125 |
|
|
126 |
|
|
127 |
|
@link |
128 |
|
|
129 |
|
@param |
130 |
|
@return@link |
131 |
|
|
|
|
| 82.9% |
Uncovered Elements: 6 (35) |
Complexity: 9 |
Complexity Density: 0.47 |
|
132 |
126095 |
public static DatabaseProduct toProduct(String productNameAsString)... |
133 |
|
{ |
134 |
126094 |
DatabaseProduct product; |
135 |
126092 |
if (productNameAsString.equalsIgnoreCase(ORACLE.getProductName())) { |
136 |
2 |
product = ORACLE; |
137 |
126090 |
} else if (productNameAsString.equalsIgnoreCase(DERBY.getProductName())) { |
138 |
1 |
product = DERBY; |
139 |
126083 |
} else if (productNameAsString.equalsIgnoreCase(HSQLDB.getProductName())) { |
140 |
126083 |
product = HSQLDB; |
141 |
4 |
} else if (productNameAsString.equalsIgnoreCase(H2.getProductName())) { |
142 |
1 |
product = H2; |
143 |
3 |
} else if (productNameAsString.startsWith(DB2.getProductName())) { |
144 |
|
|
145 |
1 |
product = DB2; |
146 |
2 |
} else if (productNameAsString.equalsIgnoreCase(MYSQL.getProductName())) { |
147 |
0 |
product = MYSQL; |
148 |
2 |
} else if (productNameAsString.equalsIgnoreCase(POSTGRESQL.getProductName())) { |
149 |
0 |
product = POSTGRESQL; |
150 |
2 |
} else if (productNameAsString.equalsIgnoreCase(MSSQL.getProductName())) { |
151 |
0 |
product = MSSQL; |
152 |
|
} else { |
153 |
2 |
product = UNKNOWN; |
154 |
|
} |
155 |
|
|
156 |
126098 |
return product; |
157 |
|
} |
158 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
159 |
0 |
@Override... |
160 |
|
public int hashCode() |
161 |
|
{ |
162 |
0 |
return getProductName().hashCode(); |
163 |
|
} |
164 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
165 |
0 |
@Override... |
166 |
|
public String toString() |
167 |
|
{ |
168 |
0 |
return getProductName(); |
169 |
|
} |
170 |
|
} |