| 1 |
|
|
| 2 |
|
|
| 3 |
|
|
| 4 |
|
|
| 5 |
|
|
| 6 |
|
|
| 7 |
|
|
| 8 |
|
|
| 9 |
|
|
| 10 |
|
|
| 11 |
|
|
| 12 |
|
|
| 13 |
|
|
| 14 |
|
|
| 15 |
|
|
| 16 |
|
|
| 17 |
|
|
| 18 |
|
|
| 19 |
|
|
| 20 |
|
package com.xpn.xwiki.doc; |
| 21 |
|
|
| 22 |
|
import org.xwiki.diff.Delta; |
| 23 |
|
|
| |
|
| 96.2% |
Uncovered Elements: 2 (52) |
Complexity: 18 |
Complexity Density: 0.64 |
|
| 24 |
|
public class AttachmentDiff |
| 25 |
|
{ |
| 26 |
|
private String fileName; |
| 27 |
|
|
| 28 |
|
private Delta.Type type; |
| 29 |
|
|
| 30 |
|
private XWikiAttachment origAttachment; |
| 31 |
|
|
| 32 |
|
private XWikiAttachment newAttachment; |
| 33 |
|
|
| 34 |
|
@Deprecated |
| 35 |
|
private String origVersion; |
| 36 |
|
|
| 37 |
|
@Deprecated |
| 38 |
|
private String newVersion; |
| 39 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (7) |
Complexity: 3 |
Complexity Density: 1 |
|
| 40 |
4 |
@Deprecated... |
| 41 |
|
public AttachmentDiff(String fileName, String origVersion, String newVersion) |
| 42 |
|
{ |
| 43 |
2 |
this(fileName, newVersion == null ? Delta.Type.DELETE : (origVersion == null ? Delta.Type.INSERT |
| 44 |
|
: Delta.Type.CHANGE), null, null); |
| 45 |
|
|
| 46 |
4 |
setOrigVersion(origVersion); |
| 47 |
4 |
setNewVersion(newVersion); |
| 48 |
|
} |
| 49 |
|
|
| 50 |
|
|
| 51 |
|
@since |
| 52 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (10) |
Complexity: 3 |
Complexity Density: 0.5 |
|
| 53 |
73 |
public AttachmentDiff(String fileName, Delta.Type type, XWikiAttachment origAttachment,... |
| 54 |
|
XWikiAttachment newAttachment) |
| 55 |
|
{ |
| 56 |
73 |
this.fileName = fileName; |
| 57 |
73 |
this.type = type; |
| 58 |
73 |
this.origAttachment = origAttachment; |
| 59 |
73 |
this.newAttachment = newAttachment; |
| 60 |
|
|
| 61 |
73 |
this.origVersion = origAttachment != null ? origAttachment.getVersion() : null; |
| 62 |
73 |
this.newVersion = newAttachment != null ? newAttachment.getVersion() : null; |
| 63 |
|
} |
| 64 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 65 |
69 |
public String getFileName()... |
| 66 |
|
{ |
| 67 |
69 |
return this.fileName; |
| 68 |
|
} |
| 69 |
|
|
| |
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 70 |
0 |
public void setFileName(String fileName)... |
| 71 |
|
{ |
| 72 |
0 |
this.fileName = fileName; |
| 73 |
|
} |
| 74 |
|
|
| 75 |
|
|
| 76 |
|
@since |
| 77 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 78 |
8 |
public Delta.Type getType()... |
| 79 |
|
{ |
| 80 |
8 |
return this.type; |
| 81 |
|
} |
| 82 |
|
|
| 83 |
|
|
| 84 |
|
@since |
| 85 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 86 |
8 |
public XWikiAttachment getOrigAttachment()... |
| 87 |
|
{ |
| 88 |
8 |
return this.origAttachment; |
| 89 |
|
} |
| 90 |
|
|
| 91 |
|
|
| 92 |
|
@since |
| 93 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 94 |
8 |
public XWikiAttachment getNewAttachment()... |
| 95 |
|
{ |
| 96 |
8 |
return this.newAttachment; |
| 97 |
|
} |
| 98 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 99 |
61 |
@Deprecated... |
| 100 |
|
public String getOrigVersion() |
| 101 |
|
{ |
| 102 |
61 |
return this.origVersion; |
| 103 |
|
} |
| 104 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 105 |
4 |
@Deprecated... |
| 106 |
|
public void setOrigVersion(String origVersion) |
| 107 |
|
{ |
| 108 |
4 |
this.origVersion = origVersion; |
| 109 |
|
} |
| 110 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 111 |
10 |
@Deprecated... |
| 112 |
|
public String getNewVersion() |
| 113 |
|
{ |
| 114 |
10 |
return this.newVersion; |
| 115 |
|
} |
| 116 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 117 |
4 |
@Deprecated... |
| 118 |
|
public void setNewVersion(String newVersion) |
| 119 |
|
{ |
| 120 |
4 |
this.newVersion = newVersion; |
| 121 |
|
} |
| 122 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (14) |
Complexity: 3 |
Complexity Density: 0.3 |
|
| 123 |
4 |
@Override... |
| 124 |
|
public String toString() |
| 125 |
|
{ |
| 126 |
4 |
StringBuilder buf = new StringBuilder(this.fileName); |
| 127 |
4 |
buf.append(": "); |
| 128 |
4 |
if (this.origVersion != null) { |
| 129 |
2 |
buf.append(this.origVersion); |
| 130 |
|
} else { |
| 131 |
2 |
buf.append("()"); |
| 132 |
|
} |
| 133 |
4 |
buf.append(" \u21E8 "); |
| 134 |
4 |
if (this.newVersion != null) { |
| 135 |
2 |
buf.append(this.newVersion); |
| 136 |
|
} else { |
| 137 |
2 |
buf.append("()"); |
| 138 |
|
} |
| 139 |
4 |
return buf.toString(); |
| 140 |
|
} |
| 141 |
|
} |