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 java.util.Date; |
23 |
|
import java.util.Locale; |
24 |
|
|
25 |
|
import org.xwiki.localization.LocaleUtils; |
26 |
|
|
27 |
|
import com.xpn.xwiki.XWikiContext; |
28 |
|
import com.xpn.xwiki.XWikiException; |
29 |
|
import com.xpn.xwiki.util.AbstractSimpleClass; |
30 |
|
import com.xpn.xwiki.util.Util; |
31 |
|
|
32 |
|
|
33 |
|
@link |
34 |
|
|
35 |
|
|
36 |
|
@version |
37 |
|
@since |
38 |
|
|
|
|
| 95.6% |
Uncovered Elements: 2 (45) |
Complexity: 19 |
Complexity Density: 0.79 |
|
39 |
|
public class XWikiDeletedDocument extends AbstractSimpleClass |
40 |
|
{ |
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
private long id; |
45 |
|
|
46 |
|
|
47 |
|
@see |
48 |
|
|
49 |
|
private String fullName; |
50 |
|
|
51 |
|
|
52 |
|
@see |
53 |
|
|
54 |
|
private Locale locale; |
55 |
|
|
56 |
|
|
57 |
|
|
58 |
|
|
59 |
|
private Date date; |
60 |
|
|
61 |
|
|
62 |
|
@see |
63 |
|
|
64 |
|
private String deleter; |
65 |
|
|
66 |
|
|
67 |
|
@see |
68 |
|
|
69 |
|
private String xml; |
70 |
|
|
71 |
|
|
72 |
|
|
73 |
|
|
|
|
| - |
Uncovered Elements: 0 (0) |
Complexity: 1 |
Complexity Density: - |
|
74 |
88 |
protected XWikiDeletedDocument()... |
75 |
|
{ |
76 |
|
} |
77 |
|
|
78 |
|
|
79 |
|
@param |
80 |
|
@param |
81 |
|
@param |
82 |
|
@param |
83 |
|
@throws |
84 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
85 |
153 |
public XWikiDeletedDocument(XWikiDocument doc, String deleter, Date deleteDate, XWikiContext context)... |
86 |
|
throws XWikiException |
87 |
|
{ |
88 |
153 |
this.fullName = doc.getFullName(); |
89 |
153 |
this.locale = doc.getLocale(); |
90 |
153 |
this.deleter = deleter; |
91 |
153 |
this.date = deleteDate; |
92 |
|
|
93 |
153 |
setDocument(doc, context); |
94 |
|
} |
95 |
|
|
96 |
|
|
97 |
|
@return |
98 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
99 |
263 |
public long getId()... |
100 |
|
{ |
101 |
263 |
return this.id; |
102 |
|
} |
103 |
|
|
104 |
|
|
105 |
|
@param |
106 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
107 |
178 |
protected void setId(long id)... |
108 |
|
{ |
109 |
178 |
this.id = id; |
110 |
|
} |
111 |
|
|
112 |
|
|
113 |
|
@return@link |
114 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
115 |
360 |
public String getFullName()... |
116 |
|
{ |
117 |
360 |
return this.fullName; |
118 |
|
} |
119 |
|
|
120 |
|
|
121 |
|
@param@link |
122 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
123 |
25 |
protected void setFullName(String docFullName)... |
124 |
|
{ |
125 |
25 |
this.fullName = docFullName; |
126 |
|
} |
127 |
|
|
128 |
|
|
129 |
|
@return@link |
130 |
|
@deprecated@link |
131 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
132 |
308 |
@Deprecated... |
133 |
|
public String getLanguage() |
134 |
|
{ |
135 |
308 |
return getLocale().toString(); |
136 |
|
} |
137 |
|
|
138 |
|
|
139 |
|
@return@link |
140 |
|
@since |
141 |
|
|
|
|
| 66.7% |
Uncovered Elements: 1 (3) |
Complexity: 2 |
Complexity Density: 2 |
|
142 |
308 |
public Locale getLocale()... |
143 |
|
{ |
144 |
308 |
return this.locale != null ? this.locale : Locale.ROOT; |
145 |
|
} |
146 |
|
|
147 |
|
|
148 |
|
@param@link |
149 |
|
@deprecated |
150 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
151 |
25 |
@Deprecated... |
152 |
|
protected void setLanguage(String locale) |
153 |
|
{ |
154 |
25 |
this.locale = LocaleUtils.toLocale(Util.normalizeLanguage(locale), Locale.ROOT); |
155 |
|
} |
156 |
|
|
157 |
|
|
158 |
|
@return |
159 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
160 |
341 |
public Date getDate()... |
161 |
|
{ |
162 |
341 |
return this.date; |
163 |
|
} |
164 |
|
|
165 |
|
|
166 |
|
@param |
167 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
168 |
25 |
protected void setDate(Date date)... |
169 |
|
{ |
170 |
25 |
this.date = date; |
171 |
|
} |
172 |
|
|
173 |
|
|
174 |
|
@return |
175 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
176 |
323 |
public String getDeleter()... |
177 |
|
{ |
178 |
323 |
return this.deleter; |
179 |
|
} |
180 |
|
|
181 |
|
|
182 |
|
@param |
183 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
184 |
25 |
protected void setDeleter(String deleter)... |
185 |
|
{ |
186 |
25 |
this.deleter = deleter; |
187 |
|
} |
188 |
|
|
189 |
|
@return@link |
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
190 |
309 |
public String getXml()... |
191 |
|
{ |
192 |
309 |
return this.xml; |
193 |
|
} |
194 |
|
|
195 |
|
@param@link |
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
196 |
178 |
protected void setXml(String xml)... |
197 |
|
{ |
198 |
178 |
this.xml = xml; |
199 |
|
} |
200 |
|
|
201 |
|
|
202 |
|
@link@link |
203 |
|
|
204 |
|
@param |
205 |
|
@param@link |
206 |
|
@throws@link |
207 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
208 |
153 |
protected void setDocument(XWikiDocument doc, XWikiContext context) throws XWikiException... |
209 |
|
{ |
210 |
153 |
setXml(doc.toFullXML(context)); |
211 |
|
} |
212 |
|
|
213 |
|
|
214 |
|
@return |
215 |
|
@param |
216 |
|
@param |
217 |
|
@throws@link |
218 |
|
|
|
|
| 85.7% |
Uncovered Elements: 1 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
219 |
3 |
public XWikiDocument restoreDocument(XWikiDocument doc, XWikiContext context) throws XWikiException... |
220 |
|
{ |
221 |
3 |
XWikiDocument result = doc; |
222 |
3 |
if (result == null) { |
223 |
3 |
result = new XWikiDocument(); |
224 |
|
} |
225 |
3 |
result.fromXML(getXml(), true); |
226 |
3 |
return result; |
227 |
|
} |
228 |
|
} |