| 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.rcs; |
| 21 |
|
|
| 22 |
|
import java.lang.ref.SoftReference; |
| 23 |
|
import java.util.Date; |
| 24 |
|
|
| 25 |
|
import org.suigeneris.jrcs.rcs.Version; |
| 26 |
|
|
| 27 |
|
import com.xpn.xwiki.XWikiContext; |
| 28 |
|
import com.xpn.xwiki.XWikiException; |
| 29 |
|
import com.xpn.xwiki.user.api.XWikiRightService; |
| 30 |
|
import com.xpn.xwiki.util.AbstractSimpleClass; |
| 31 |
|
|
| 32 |
|
|
| 33 |
|
|
| 34 |
|
|
| 35 |
|
@version |
| 36 |
|
@since |
| 37 |
|
|
| |
|
| 96% |
Uncovered Elements: 2 (50) |
Complexity: 22 |
Complexity Density: 0.88 |
|
| 38 |
|
public class XWikiRCSNodeInfo extends AbstractSimpleClass implements Comparable<XWikiRCSNodeInfo> |
| 39 |
|
{ |
| 40 |
|
|
| 41 |
|
|
| 42 |
|
|
| 43 |
|
private XWikiRCSNodeId id; |
| 44 |
|
|
| 45 |
|
|
| 46 |
|
|
| 47 |
|
|
| 48 |
|
private Date date = new Date(); |
| 49 |
|
|
| 50 |
|
|
| 51 |
|
|
| 52 |
|
|
| 53 |
|
private String author = XWikiRightService.GUEST_USER_FULLNAME; |
| 54 |
|
|
| 55 |
|
|
| 56 |
|
|
| 57 |
|
|
| 58 |
|
private String comment = ""; |
| 59 |
|
|
| 60 |
|
|
| 61 |
|
|
| 62 |
|
|
| 63 |
|
private boolean isDiff = true; |
| 64 |
|
|
| 65 |
|
|
| 66 |
|
|
| 67 |
|
|
| 68 |
|
private SoftReference<XWikiRCSNodeContent> contentRef; |
| 69 |
|
|
| 70 |
|
|
| 71 |
|
|
| 72 |
|
|
| |
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
| 73 |
3773 |
public XWikiRCSNodeInfo()... |
| 74 |
|
{ |
| 75 |
|
} |
| 76 |
|
|
| 77 |
|
|
| 78 |
|
@param |
| 79 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 80 |
5752 |
public XWikiRCSNodeInfo(XWikiRCSNodeId id)... |
| 81 |
|
{ |
| 82 |
5752 |
setId((XWikiRCSNodeId) id.clone()); |
| 83 |
|
} |
| 84 |
|
|
| 85 |
|
|
| 86 |
|
@return |
| 87 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 88 |
56153 |
public XWikiRCSNodeId getId()... |
| 89 |
|
{ |
| 90 |
56153 |
return this.id; |
| 91 |
|
} |
| 92 |
|
|
| 93 |
|
|
| 94 |
|
@param |
| 95 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 96 |
15378 |
public void setId(XWikiRCSNodeId id)... |
| 97 |
|
{ |
| 98 |
15378 |
this.id = id; |
| 99 |
|
} |
| 100 |
|
|
| 101 |
|
|
| 102 |
|
@return |
| 103 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 104 |
15374 |
public Date getDate()... |
| 105 |
|
{ |
| 106 |
15374 |
return this.date; |
| 107 |
|
} |
| 108 |
|
|
| 109 |
|
|
| 110 |
|
@param |
| 111 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 112 |
9525 |
public void setDate(Date updateDate)... |
| 113 |
|
{ |
| 114 |
9525 |
this.date = updateDate; |
| 115 |
|
} |
| 116 |
|
|
| 117 |
|
|
| 118 |
|
@return |
| 119 |
|
|
| |
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
| 120 |
15385 |
public String getAuthor()... |
| 121 |
|
{ |
| 122 |
|
|
| 123 |
|
|
| 124 |
|
|
| 125 |
15385 |
return this.author != null ? this.author : ""; |
| 126 |
|
} |
| 127 |
|
|
| 128 |
|
|
| 129 |
|
@param |
| 130 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 131 |
9525 |
public void setAuthor(String updateAuthor)... |
| 132 |
|
{ |
| 133 |
9525 |
this.author = updateAuthor; |
| 134 |
|
} |
| 135 |
|
|
| 136 |
|
|
| 137 |
|
@return |
| 138 |
|
|
| |
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
| 139 |
15385 |
public String getComment()... |
| 140 |
|
{ |
| 141 |
|
|
| 142 |
|
|
| 143 |
|
|
| 144 |
15385 |
return this.comment != null ? this.comment : ""; |
| 145 |
|
} |
| 146 |
|
|
| 147 |
|
|
| 148 |
|
@param |
| 149 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 150 |
9525 |
public void setComment(String comment)... |
| 151 |
|
{ |
| 152 |
9525 |
this.comment = comment; |
| 153 |
|
} |
| 154 |
|
|
| 155 |
|
|
| 156 |
|
@return |
| 157 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 158 |
41 |
public boolean isMinorEdit()... |
| 159 |
|
{ |
| 160 |
41 |
return this.id.getVersion().at(1) != 1; |
| 161 |
|
} |
| 162 |
|
|
| 163 |
|
|
| 164 |
|
@return |
| 165 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 166 |
25963 |
public boolean isDiff()... |
| 167 |
|
{ |
| 168 |
25963 |
return this.isDiff; |
| 169 |
|
} |
| 170 |
|
|
| 171 |
|
|
| 172 |
|
@param |
| 173 |
|
@see |
| 174 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 175 |
10879 |
public void setDiff(boolean diff)... |
| 176 |
|
{ |
| 177 |
10879 |
this.isDiff = diff; |
| 178 |
|
} |
| 179 |
|
|
| 180 |
|
|
| 181 |
|
@return@link |
| 182 |
|
@param |
| 183 |
|
@throws |
| 184 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (12) |
Complexity: 4 |
Complexity Density: 0.5 |
|
| 185 |
801 |
public XWikiRCSNodeContent getContent(XWikiContext context) throws XWikiException... |
| 186 |
|
{ |
| 187 |
801 |
XWikiRCSNodeContent nodeContent = null; |
| 188 |
801 |
if (this.contentRef != null) { |
| 189 |
126 |
nodeContent = this.contentRef.get(); |
| 190 |
|
} |
| 191 |
801 |
if (nodeContent != null || context == null) { |
| 192 |
126 |
return nodeContent; |
| 193 |
|
} |
| 194 |
675 |
nodeContent = context.getWiki().getVersioningStore() |
| 195 |
|
.loadRCSNodeContent(this.id, true, context); |
| 196 |
675 |
this.contentRef = new SoftReference<XWikiRCSNodeContent>(nodeContent); |
| 197 |
675 |
return nodeContent; |
| 198 |
|
} |
| 199 |
|
|
| 200 |
|
|
| 201 |
|
@param@link |
| 202 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0.33 |
|
| 203 |
6284 |
public void setContent(XWikiRCSNodeContent content)... |
| 204 |
|
{ |
| 205 |
6284 |
content.setId(getId()); |
| 206 |
6284 |
this.contentRef = new SoftReference<XWikiRCSNodeContent>(content); |
| 207 |
6284 |
setDiff(content.getPatch().isDiff()); |
| 208 |
|
} |
| 209 |
|
|
| 210 |
|
|
| 211 |
|
@return |
| 212 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 213 |
22 |
public Version getVersion()... |
| 214 |
|
{ |
| 215 |
22 |
return getId().getVersion(); |
| 216 |
|
} |
| 217 |
|
|
| |
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
| 218 |
5924 |
@Override... |
| 219 |
|
public int compareTo(XWikiRCSNodeInfo o) |
| 220 |
|
{ |
| 221 |
5924 |
return getId().getVersion().compareTo(o.getId().getVersion()); |
| 222 |
|
} |
| 223 |
|
} |