1 |
|
package org.apache.torque.mojo; |
2 |
|
|
3 |
|
import org.apache.commons.lang.StringUtils; |
4 |
|
import org.apache.maven.plugin.MojoExecutionException; |
5 |
|
import org.apache.maven.plugin.descriptor.PluginDescriptor; |
6 |
|
import org.apache.torque.util.JdbcConfigurer; |
7 |
|
import org.kuali.core.db.torque.DumpTask; |
8 |
|
import org.kuali.core.db.torque.PropertyHandlingException; |
9 |
|
import org.kuali.core.db.torque.StringFilter; |
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
|
|
| 0% |
Uncovered Elements: 77 (77) |
Complexity: 30 |
Complexity Density: 0.67 |
|
14 |
|
public abstract class ExportMojo extends AntTaskMojo { |
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
|
21 |
|
private boolean antCompatibilityMode; |
22 |
|
|
23 |
|
|
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
private String artifactId; |
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
private boolean includeVersionInComment; |
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
private String comment; |
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
private String includes; |
57 |
|
|
58 |
|
|
59 |
|
|
60 |
|
|
61 |
|
|
62 |
|
|
63 |
|
private String excludes; |
64 |
|
|
65 |
|
|
66 |
|
|
67 |
|
|
68 |
|
|
69 |
|
|
70 |
|
|
71 |
|
|
72 |
|
private String targetDatabase; |
73 |
|
|
74 |
|
|
75 |
|
|
76 |
|
|
77 |
|
|
78 |
|
|
79 |
|
|
80 |
|
|
81 |
|
|
82 |
|
|
83 |
|
|
84 |
|
private String schema; |
85 |
|
|
86 |
|
|
87 |
|
|
88 |
|
|
89 |
|
|
90 |
|
|
91 |
|
|
92 |
|
|
93 |
|
|
94 |
|
private String driver; |
95 |
|
|
96 |
|
|
97 |
|
|
98 |
|
|
99 |
|
|
100 |
|
|
101 |
|
|
102 |
|
private String url; |
103 |
|
|
104 |
|
|
105 |
|
|
106 |
|
|
107 |
|
|
108 |
|
|
109 |
|
|
110 |
|
|
111 |
|
|
112 |
|
|
113 |
|
private String username; |
114 |
|
|
115 |
|
|
116 |
|
|
117 |
|
|
118 |
|
|
119 |
|
|
120 |
|
|
121 |
|
|
122 |
|
|
123 |
|
|
124 |
|
private String password; |
125 |
|
|
126 |
|
|
127 |
|
|
128 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
129 |
0
|
public String getDriver() {... |
130 |
0
|
return driver; |
131 |
|
} |
132 |
|
|
133 |
|
|
134 |
|
|
135 |
|
|
136 |
|
@param |
137 |
|
|
138 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
139 |
0
|
public void setDriver(final String driver) {... |
140 |
0
|
this.driver = driver; |
141 |
|
} |
142 |
|
|
143 |
|
|
144 |
|
|
145 |
|
|
146 |
|
@return |
147 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
148 |
0
|
public String getPassword() {... |
149 |
0
|
return password; |
150 |
|
} |
151 |
|
|
152 |
|
|
153 |
|
|
154 |
|
|
155 |
|
@param |
156 |
|
|
157 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
158 |
0
|
public void setPassword(final String password) {... |
159 |
0
|
this.password = password; |
160 |
|
} |
161 |
|
|
162 |
|
|
163 |
|
|
164 |
|
|
165 |
|
@return |
166 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
167 |
0
|
public String getUrl() {... |
168 |
0
|
return url; |
169 |
|
} |
170 |
|
|
171 |
|
|
172 |
|
|
173 |
|
|
174 |
|
@param |
175 |
|
|
176 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
177 |
0
|
public void setUrl(final String url) {... |
178 |
0
|
this.url = url; |
179 |
|
} |
180 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
181 |
0
|
public String getUsername() {... |
182 |
0
|
return username; |
183 |
|
} |
184 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
185 |
0
|
public void setUsername(final String username) {... |
186 |
0
|
this.username = username; |
187 |
|
} |
188 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
189 |
0
|
public String getSchema() {... |
190 |
0
|
return schema; |
191 |
|
} |
192 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
193 |
0
|
public void setSchema(final String schema) {... |
194 |
0
|
this.schema = schema; |
195 |
|
} |
196 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
197 |
0
|
public String getTargetDatabase() {... |
198 |
0
|
return targetDatabase; |
199 |
|
} |
200 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
201 |
0
|
public void setTargetDatabase(final String targetDatabase) {... |
202 |
0
|
this.targetDatabase = targetDatabase; |
203 |
|
} |
204 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
205 |
0
|
public String getIncludes() {... |
206 |
0
|
return includes; |
207 |
|
} |
208 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
209 |
0
|
public void setIncludes(final String includePatterns) {... |
210 |
0
|
this.includes = includePatterns; |
211 |
|
} |
212 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
213 |
0
|
public String getExcludes() {... |
214 |
0
|
return excludes; |
215 |
|
} |
216 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
217 |
0
|
public void setExcludes(final String excludePatterns) {... |
218 |
0
|
this.excludes = excludePatterns; |
219 |
|
} |
220 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
221 |
0
|
public String getComment() {... |
222 |
0
|
return comment; |
223 |
|
} |
224 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
225 |
0
|
public void setComment(final String comment) {... |
226 |
0
|
this.comment = comment; |
227 |
|
} |
228 |
|
|
|
|
| 0% |
Uncovered Elements: 17 (17) |
Complexity: 4 |
Complexity Density: 0.36 |
|
229 |
0
|
protected String getUpdatedComment() {... |
230 |
0
|
PluginDescriptor descriptor = (PluginDescriptor) this.getPluginContext().get("pluginDescriptor"); |
231 |
0
|
if (descriptor == null) { |
232 |
|
|
233 |
0
|
return " Auto-generated by the maven-impex-plugin " + getComment(); |
234 |
|
} |
235 |
0
|
String name = descriptor.getName(); |
236 |
0
|
String version = descriptor.getVersion(); |
237 |
0
|
String comment = " Auto-generated by the " + name; |
238 |
0
|
if (isIncludeVersionInComment()) { |
239 |
0
|
comment += " v" + version + " "; |
240 |
|
} |
241 |
0
|
if (!StringUtils.isEmpty(getComment())) { |
242 |
0
|
comment += getComment(); |
243 |
|
} |
244 |
0
|
return comment; |
245 |
|
} |
246 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 2 |
Complexity Density: 0.2 |
|
247 |
0
|
@Override... |
248 |
|
protected void configureTask() throws MojoExecutionException { |
249 |
0
|
setComment(getUpdatedComment()); |
250 |
0
|
try { |
251 |
0
|
JdbcConfigurer configurer = new JdbcConfigurer(); |
252 |
0
|
configurer.updateConfiguration(this); |
253 |
0
|
configurer.validateConfiguration(this); |
254 |
|
} catch (PropertyHandlingException e) { |
255 |
0
|
throw new MojoExecutionException("Error handling properties", e); |
256 |
|
} |
257 |
0
|
super.configureTask(); |
258 |
0
|
DumpTask task = (DumpTask) super.getAntTask(); |
259 |
0
|
task.setIncludePatterns(StringFilter.getListFromCSV(getIncludes())); |
260 |
0
|
task.setExcludePatterns(StringFilter.getListFromCSV(getExcludes())); |
261 |
|
} |
262 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
263 |
0
|
public String getArtifactId() {... |
264 |
0
|
return artifactId; |
265 |
|
} |
266 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
267 |
0
|
public void setArtifactId(final String artifactId) {... |
268 |
0
|
this.artifactId = artifactId; |
269 |
|
} |
270 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
271 |
0
|
public boolean isAntCompatibilityMode() {... |
272 |
0
|
return antCompatibilityMode; |
273 |
|
} |
274 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
275 |
0
|
public void setAntCompatibilityMode(final boolean antCompatibilityMode) {... |
276 |
0
|
this.antCompatibilityMode = antCompatibilityMode; |
277 |
|
} |
278 |
|
|
279 |
|
|
280 |
|
@return |
281 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
282 |
0
|
public boolean isIncludeVersionInComment() {... |
283 |
0
|
return includeVersionInComment; |
284 |
|
} |
285 |
|
|
286 |
|
|
287 |
|
@param |
288 |
|
|
289 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
290 |
0
|
public void setIncludeVersionInComment(final boolean includeVersionInComment) {... |
291 |
0
|
this.includeVersionInComment = includeVersionInComment; |
292 |
|
} |
293 |
|
} |