1 |
|
package org.apache.torque.mojo.morph; |
2 |
|
|
3 |
|
import org.codehaus.plexus.util.StringUtils; |
4 |
|
|
|
|
| 0% |
Uncovered Elements: 24 (24) |
Complexity: 10 |
Complexity Density: 0.77 |
|
5 |
|
public class DataMorpher extends Morpher { |
6 |
|
|
7 |
|
String antPrologue = "<?xml version=\"1.0\"?>"; |
8 |
|
|
9 |
|
String newPrologue = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"; |
10 |
|
|
11 |
|
|
12 |
|
String antDocType = "<!DOCTYPE dataset SYSTEM \"data.dtd\">"; |
13 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
14 |
0
|
public DataMorpher() {... |
15 |
0
|
this(null, null); |
16 |
|
} |
17 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
18 |
0
|
public DataMorpher(MorphRequest morphRequest, String artifactId) {... |
19 |
0
|
super(morphRequest, artifactId); |
20 |
|
} |
21 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
22 |
0
|
protected String getNewDocType() {... |
23 |
0
|
return "<!DOCTYPE dataset SYSTEM \"" + getArtifactId() + ".dtd\">"; |
24 |
|
} |
25 |
|
|
|
|
| 0% |
Uncovered Elements: 2 (2) |
Complexity: 1 |
Complexity Density: 0.5 |
|
26 |
0
|
protected String getMorphedContents(String contents) {... |
27 |
0
|
contents = StringUtils.replace(contents, antPrologue, newPrologue); |
28 |
0
|
return StringUtils.replace(contents, antDocType, getNewDocType()); |
29 |
|
} |
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0.5 |
|
34 |
0
|
protected boolean isMorphNeeded(String contents) {... |
35 |
|
|
36 |
0
|
int pos = contents.indexOf(getNewDocType()); |
37 |
|
|
38 |
0
|
if (pos == -1) { |
39 |
|
|
40 |
0
|
return true; |
41 |
|
} else { |
42 |
|
|
43 |
0
|
return false; |
44 |
|
} |
45 |
|
} |
46 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
47 |
0
|
public String getAntPrologue() {... |
48 |
0
|
return antPrologue; |
49 |
|
} |
50 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
51 |
0
|
public void setAntPrologue(String antPrologue) {... |
52 |
0
|
this.antPrologue = antPrologue; |
53 |
|
} |
54 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
55 |
0
|
public String getNewPrologue() {... |
56 |
0
|
return newPrologue; |
57 |
|
} |
58 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
59 |
0
|
public void setNewPrologue(String newPrologue) {... |
60 |
0
|
this.newPrologue = newPrologue; |
61 |
|
} |
62 |
|
|
63 |
|
} |