1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package com.xpn.xwiki.stats.impl.xwiki; |
21 |
|
|
22 |
|
import java.text.MessageFormat; |
23 |
|
import java.util.ArrayList; |
24 |
|
import java.util.Collection; |
25 |
|
import java.util.Collections; |
26 |
|
import java.util.Date; |
27 |
|
import java.util.HashMap; |
28 |
|
import java.util.List; |
29 |
|
import java.util.Map; |
30 |
|
|
31 |
|
import org.apache.commons.collections4.CollectionUtils; |
32 |
|
import org.apache.commons.lang3.StringUtils; |
33 |
|
import org.joda.time.DateTime; |
34 |
|
import org.slf4j.Logger; |
35 |
|
import org.slf4j.LoggerFactory; |
36 |
|
import org.xwiki.model.reference.DocumentReference; |
37 |
|
import org.xwiki.model.reference.EntityReferenceSerializer; |
38 |
|
|
39 |
|
import com.xpn.xwiki.XWikiContext; |
40 |
|
import com.xpn.xwiki.XWikiException; |
41 |
|
import com.xpn.xwiki.criteria.impl.Duration; |
42 |
|
import com.xpn.xwiki.criteria.impl.Period; |
43 |
|
import com.xpn.xwiki.criteria.impl.Range; |
44 |
|
import com.xpn.xwiki.criteria.impl.RangeFactory; |
45 |
|
import com.xpn.xwiki.criteria.impl.Scope; |
46 |
|
import com.xpn.xwiki.stats.impl.DocumentStats; |
47 |
|
import com.xpn.xwiki.stats.impl.RefererStats; |
48 |
|
import com.xpn.xwiki.stats.impl.StatsUtil; |
49 |
|
import com.xpn.xwiki.stats.impl.StatsUtil.PeriodType; |
50 |
|
import com.xpn.xwiki.stats.impl.VisitStats; |
51 |
|
import com.xpn.xwiki.store.XWikiHibernateStore; |
52 |
|
import com.xpn.xwiki.web.DownloadAction; |
53 |
|
import com.xpn.xwiki.web.SaveAction; |
54 |
|
import com.xpn.xwiki.web.Utils; |
55 |
|
import com.xpn.xwiki.web.ViewAction; |
56 |
|
|
57 |
|
|
58 |
|
|
59 |
|
|
60 |
|
@version |
61 |
|
@since |
62 |
|
|
|
|
| 0% |
Uncovered Elements: 238 (238) |
Complexity: 47 |
Complexity Density: 0.26 |
|
63 |
|
public class XWikiStatsReader |
64 |
|
{ |
65 |
|
|
66 |
|
|
67 |
|
|
68 |
|
private static final Logger LOGGER = LoggerFactory.getLogger(XWikiStatsReader.class); |
69 |
|
|
70 |
|
|
71 |
|
|
72 |
|
|
73 |
|
private EntityReferenceSerializer<String> compactwikiEntityReferenceSerializer = Utils.getComponent( |
74 |
|
EntityReferenceSerializer.TYPE_STRING, "compactwiki"); |
75 |
|
|
76 |
|
|
77 |
|
|
78 |
|
|
79 |
|
@param |
80 |
|
@param |
81 |
|
@param |
82 |
|
@return |
83 |
|
|
|
|
| 0% |
Uncovered Elements: 16 (16) |
Complexity: 5 |
Complexity Density: 0.5 |
|
84 |
0 |
public Collection<Object> getRecentActions(String action, int size, XWikiContext context)... |
85 |
|
{ |
86 |
0 |
List<Object> list = new ArrayList<Object>(); |
87 |
|
|
88 |
0 |
if ((action.equals(ViewAction.VIEW_ACTION) || (action.equals(SaveAction.ACTION_NAME)))) { |
89 |
0 |
Collection<?> actions = StatsUtil.getRecentActionFromSessions(context, action); |
90 |
|
|
91 |
0 |
if (actions != null) { |
92 |
0 |
Object[] actionsarray = actions.toArray(); |
93 |
0 |
CollectionUtils.reverseArray(actionsarray); |
94 |
0 |
int nb = Math.min(actions.size(), size); |
95 |
0 |
for (int i = 0; i < nb; i++) { |
96 |
0 |
list.add(actionsarray[i]); |
97 |
|
} |
98 |
|
} |
99 |
|
} |
100 |
|
|
101 |
0 |
return list; |
102 |
|
} |
103 |
|
|
104 |
|
|
105 |
|
@param |
106 |
|
@return |
107 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.4 |
|
108 |
0 |
private String getHqlSortOrderFromRange(Range range)... |
109 |
|
{ |
110 |
0 |
String sortOrder; |
111 |
|
|
112 |
0 |
if (range.getSize() < 0) { |
113 |
0 |
sortOrder = "asc"; |
114 |
|
} else { |
115 |
0 |
sortOrder = "desc"; |
116 |
|
} |
117 |
|
|
118 |
0 |
return sortOrder; |
119 |
|
} |
120 |
|
|
121 |
|
|
122 |
|
@param |
123 |
|
@return |
124 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 3 |
Complexity Density: 1 |
|
125 |
0 |
private String getHqlValidDomain(String domain)... |
126 |
|
{ |
127 |
0 |
if (domain == null || domain.trim().length() == 0) { |
128 |
0 |
return "%"; |
129 |
|
} |
130 |
|
|
131 |
0 |
return domain; |
132 |
|
} |
133 |
|
|
134 |
|
|
135 |
|
@param |
136 |
|
@param |
137 |
|
@return |
138 |
|
|
|
|
| 0% |
Uncovered Elements: 16 (16) |
Complexity: 7 |
Complexity Density: 0.7 |
|
139 |
0 |
private String getHqlNameFilterFromScope(Scope scope, List<Object> paramList)... |
140 |
|
{ |
141 |
0 |
String nameFilter; |
142 |
|
|
143 |
|
|
144 |
0 |
if (scope.getType() == Scope.SPACE_SCOPE && StringUtils.isEmpty(scope.getName())) { |
145 |
|
|
146 |
|
|
147 |
0 |
nameFilter = "name not like '%.%' and (name <> '' or (name is not null and '' is null))"; |
148 |
0 |
} else if (scope.getType() == Scope.GLOBAL_SCOPE && StringUtils.isEmpty(scope.getName())) { |
149 |
|
|
150 |
0 |
nameFilter = "name = '' or name is null"; |
151 |
0 |
} else if (scope.getType() == Scope.PAGE_SCOPE && StringUtils.isEmpty(scope.getName())) { |
152 |
|
|
153 |
0 |
nameFilter = "name like '%.%'"; |
154 |
|
} else { |
155 |
0 |
nameFilter = "name like ?"; |
156 |
0 |
paramList.add(scope.getPattern()); |
157 |
|
} |
158 |
|
|
159 |
0 |
return nameFilter; |
160 |
|
} |
161 |
|
|
162 |
|
|
163 |
|
|
164 |
|
|
165 |
|
@param |
166 |
|
@param |
167 |
|
@param |
168 |
|
@param |
169 |
|
@param |
170 |
|
@return |
171 |
|
|
|
|
| 0% |
Uncovered Elements: 21 (21) |
Complexity: 4 |
Complexity Density: 0.27 |
|
172 |
0 |
public Map<DateTime, Integer> getActionStatistics(String action, Scope scope, Period period, Duration step,... |
173 |
|
XWikiContext context) |
174 |
|
{ |
175 |
0 |
DateTime stepStart = new DateTime(period.getStart()); |
176 |
0 |
DateTime periodEnd = new DateTime(period.getEnd()); |
177 |
0 |
org.joda.time.Period stepDuration = |
178 |
|
new org.joda.time.Period(step.getYears(), step.getMonths(), step.getWeeks(), step.getDays(), 0, 0, 0, 0); |
179 |
|
|
180 |
0 |
Map<DateTime, Integer> activity = new HashMap<DateTime, Integer>(); |
181 |
0 |
while (stepStart.compareTo(periodEnd) < 0) { |
182 |
0 |
DateTime stepEnd = stepStart.plus(stepDuration); |
183 |
0 |
if (stepEnd.compareTo(periodEnd) > 0) { |
184 |
0 |
stepEnd = periodEnd; |
185 |
|
} |
186 |
0 |
List<DocumentStats> stats = |
187 |
|
getDocumentStatistics(action, scope, new Period(stepStart.getMillis(), stepEnd.getMillis()), |
188 |
|
RangeFactory.FIRST, context); |
189 |
0 |
int actionCount = 0; |
190 |
0 |
if (stats.size() > 0) { |
191 |
0 |
actionCount = stats.get(0).getPageViews(); |
192 |
|
} |
193 |
0 |
activity.put(stepStart, actionCount); |
194 |
0 |
stepStart = stepEnd; |
195 |
|
} |
196 |
|
|
197 |
0 |
return activity; |
198 |
|
} |
199 |
|
|
200 |
|
|
201 |
|
|
202 |
|
|
203 |
|
@param |
204 |
|
|
205 |
|
@param |
206 |
|
@param |
207 |
|
@param |
208 |
|
@param |
209 |
|
@return |
210 |
|
|
|
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 3 |
Complexity Density: 0.19 |
|
211 |
0 |
public List<DocumentStats> getDocumentStatistics(String action, Scope scope, Period period, Range range,... |
212 |
|
XWikiContext context) |
213 |
|
{ |
214 |
0 |
List<DocumentStats> documentStatsList; |
215 |
|
|
216 |
0 |
List<Object> paramList = new ArrayList<Object>(4); |
217 |
|
|
218 |
0 |
String nameFilter = getHqlNameFilterFromScope(scope, paramList); |
219 |
|
|
220 |
0 |
String sortOrder = getHqlSortOrderFromRange(range); |
221 |
|
|
222 |
0 |
XWikiHibernateStore store = context.getWiki().getHibernateStore(); |
223 |
|
|
224 |
0 |
try { |
225 |
0 |
String query = |
226 |
|
MessageFormat.format("select name, sum(pageViews) from DocumentStats" |
227 |
|
+ " where ({0}) and action=? and ? <= period and period < ? group by name order" |
228 |
|
+ " by sum(pageViews) {1}", nameFilter, sortOrder); |
229 |
|
|
230 |
0 |
paramList.add(action); |
231 |
0 |
paramList.add(period.getStartCode()); |
232 |
0 |
paramList.add(period.getEndCode()); |
233 |
|
|
234 |
0 |
List<?> solist = |
235 |
|
store.search(query, range.getAbsoluteSize(), range.getAbsoluteStart(), paramList, context); |
236 |
|
|
237 |
0 |
documentStatsList = getDocumentStatistics(solist, action); |
238 |
0 |
if (range.getSize() < 0) { |
239 |
0 |
Collections.reverse(documentStatsList); |
240 |
|
} |
241 |
|
} catch (XWikiException e) { |
242 |
0 |
documentStatsList = Collections.emptyList(); |
243 |
|
} |
244 |
|
|
245 |
0 |
return documentStatsList; |
246 |
|
} |
247 |
|
|
248 |
|
|
249 |
|
|
250 |
|
|
251 |
|
@param |
252 |
|
@param |
253 |
|
@return@link |
254 |
|
@see |
255 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
|
256 |
0 |
private List<DocumentStats> getDocumentStatistics(List<?> resultSet, String action)... |
257 |
|
{ |
258 |
0 |
List<DocumentStats> documentStatsList = new ArrayList<DocumentStats>(resultSet.size()); |
259 |
|
|
260 |
0 |
Date now = new Date(); |
261 |
|
|
262 |
0 |
for (Object name : resultSet) { |
263 |
0 |
Object[] result = (Object[]) name; |
264 |
|
|
265 |
|
|
266 |
0 |
DocumentStats docStats = new DocumentStats((String) result[0], action, now, PeriodType.DAY); |
267 |
0 |
docStats.setPageViews(((Number) result[1]).intValue()); |
268 |
0 |
documentStatsList.add(docStats); |
269 |
|
} |
270 |
|
|
271 |
0 |
return documentStatsList; |
272 |
|
} |
273 |
|
|
274 |
|
|
275 |
|
|
276 |
|
|
277 |
|
@param |
278 |
|
@param |
279 |
|
@param |
280 |
|
@param |
281 |
|
@param |
282 |
|
@return |
283 |
|
|
|
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 3 |
Complexity Density: 0.19 |
|
284 |
0 |
public List<DocumentStats> getBackLinkStatistics(String domain, Scope scope, Period period, Range range,... |
285 |
|
XWikiContext context) |
286 |
|
{ |
287 |
0 |
List<DocumentStats> documentStatsList; |
288 |
|
|
289 |
0 |
List<Object> paramList = new ArrayList<Object>(4); |
290 |
|
|
291 |
0 |
String nameFilter = getHqlNameFilterFromScope(scope, paramList); |
292 |
|
|
293 |
0 |
String sortOrder = getHqlSortOrderFromRange(range); |
294 |
|
|
295 |
0 |
XWikiHibernateStore store = context.getWiki().getHibernateStore(); |
296 |
0 |
try { |
297 |
0 |
String query = |
298 |
|
MessageFormat.format("select name, sum(pageViews) from RefererStats" |
299 |
|
+ " where ({0}) and referer like ? and ? <= period and period < ? group by name" |
300 |
|
+ " order by sum(pageViews) {1}", nameFilter, sortOrder); |
301 |
|
|
302 |
0 |
paramList.add(getHqlValidDomain(domain)); |
303 |
0 |
paramList.add(period.getStartCode()); |
304 |
0 |
paramList.add(period.getEndCode()); |
305 |
|
|
306 |
0 |
List<?> solist = |
307 |
|
store.search(query, range.getAbsoluteSize(), range.getAbsoluteStart(), paramList, context); |
308 |
|
|
309 |
0 |
documentStatsList = getDocumentStatistics(solist, "refer"); |
310 |
0 |
if (range.getSize() < 0) { |
311 |
0 |
Collections.reverse(documentStatsList); |
312 |
|
} |
313 |
|
} catch (XWikiException e) { |
314 |
0 |
documentStatsList = Collections.emptyList(); |
315 |
|
} |
316 |
|
|
317 |
0 |
return documentStatsList; |
318 |
|
} |
319 |
|
|
320 |
|
|
321 |
|
|
322 |
|
|
323 |
|
@param |
324 |
|
|
325 |
|
@param |
326 |
|
@param |
327 |
|
@param |
328 |
|
@param |
329 |
|
@return |
330 |
|
|
|
|
| 0% |
Uncovered Elements: 18 (18) |
Complexity: 3 |
Complexity Density: 0.19 |
|
331 |
0 |
public List<RefererStats> getRefererStatistics(String domain, Scope scope, Period period, Range range,... |
332 |
|
XWikiContext context) |
333 |
|
{ |
334 |
0 |
List<RefererStats> refererList; |
335 |
|
|
336 |
0 |
List<Object> paramList = new ArrayList<Object>(4); |
337 |
|
|
338 |
0 |
String nameFilter = getHqlNameFilterFromScope(scope, paramList); |
339 |
|
|
340 |
0 |
String sortOrder = getHqlSortOrderFromRange(range); |
341 |
|
|
342 |
0 |
XWikiHibernateStore store = context.getWiki().getHibernateStore(); |
343 |
0 |
try { |
344 |
0 |
String query = |
345 |
|
MessageFormat.format("select referer, sum(pageViews) from RefererStats" |
346 |
|
+ " where ({0}) and referer like ? and ? <= period and period < ?" |
347 |
|
+ " group by referer order by sum(pageViews) {1}", nameFilter, sortOrder); |
348 |
|
|
349 |
0 |
paramList.add(getHqlValidDomain(domain)); |
350 |
0 |
paramList.add(period.getStartCode()); |
351 |
0 |
paramList.add(period.getEndCode()); |
352 |
|
|
353 |
0 |
List<?> solist = |
354 |
|
store.search(query, range.getAbsoluteSize(), range.getAbsoluteStart(), paramList, context); |
355 |
|
|
356 |
0 |
refererList = getRefererStatistics(solist); |
357 |
0 |
if (range.getSize() < 0) { |
358 |
0 |
Collections.reverse(refererList); |
359 |
|
} |
360 |
|
} catch (XWikiException e) { |
361 |
0 |
refererList = Collections.emptyList(); |
362 |
|
} |
363 |
|
|
364 |
0 |
return refererList; |
365 |
|
} |
366 |
|
|
367 |
|
|
368 |
|
@link |
369 |
|
|
370 |
|
|
371 |
|
@param |
372 |
|
@return@link |
373 |
|
@see |
374 |
|
|
|
|
| 0% |
Uncovered Elements: 8 (8) |
Complexity: 1 |
Complexity Density: 0.12 |
|
375 |
0 |
private List<RefererStats> getRefererStatistics(List<?> resultSet)... |
376 |
|
{ |
377 |
0 |
Date now = new Date(); |
378 |
0 |
List<RefererStats> stats = new ArrayList<RefererStats>(resultSet.size()); |
379 |
|
|
380 |
0 |
for (Object name : resultSet) { |
381 |
0 |
Object[] result = (Object[]) name; |
382 |
|
|
383 |
|
|
384 |
|
|
385 |
0 |
RefererStats refStats = new RefererStats("", (String) result[0], now, PeriodType.DAY); |
386 |
0 |
refStats.setPageViews(((Number) result[1]).intValue()); |
387 |
0 |
stats.add(refStats); |
388 |
|
} |
389 |
|
|
390 |
0 |
return stats; |
391 |
|
} |
392 |
|
|
393 |
|
|
394 |
|
@link |
395 |
|
|
396 |
|
@param |
397 |
|
|
398 |
|
@param |
399 |
|
@param |
400 |
|
@param |
401 |
|
@param |
402 |
|
@return |
403 |
|
|
|
|
| 0% |
Uncovered Elements: 38 (38) |
Complexity: 7 |
Complexity Density: 0.25 |
|
404 |
0 |
private String createVisitStatisticsQuery(String action, Period period, Range range, List<Object> paramList,... |
405 |
|
XWikiContext context) |
406 |
|
{ |
407 |
0 |
StringBuilder query = new StringBuilder("select name, sum(pageSaves), sum(pageViews), sum(downloads)"); |
408 |
|
|
409 |
0 |
query.append(" from VisitStats"); |
410 |
|
|
411 |
0 |
query.append(" where"); |
412 |
|
|
413 |
|
|
414 |
|
|
415 |
0 |
StringBuilder userListWhere = new StringBuilder(); |
416 |
0 |
try { |
417 |
0 |
for (DocumentReference user : StatsUtil.getRequestFilteredUsers(context)) { |
418 |
0 |
if (userListWhere.length() > 0) { |
419 |
0 |
userListWhere.append(", "); |
420 |
|
} |
421 |
0 |
userListWhere.append('?'); |
422 |
|
|
423 |
0 |
paramList.add(this.compactwikiEntityReferenceSerializer.serialize(user)); |
424 |
|
} |
425 |
|
} catch (Exception e) { |
426 |
0 |
LOGGER.error("Faild to get filter users list", e); |
427 |
|
} |
428 |
|
|
429 |
0 |
if (userListWhere.length() > 0) { |
430 |
0 |
query.append(" name NOT IN ("); |
431 |
0 |
query.append(userListWhere); |
432 |
0 |
query.append(") and "); |
433 |
|
} |
434 |
|
|
435 |
|
|
436 |
|
|
437 |
0 |
query.append(" ? <= startDate and endDate < ? group by name"); |
438 |
0 |
paramList.add(new Date(period.getStart())); |
439 |
0 |
paramList.add(new Date(period.getEnd())); |
440 |
|
|
441 |
|
|
442 |
|
|
443 |
0 |
query.append(' '); |
444 |
|
|
445 |
0 |
String sortOrder = getHqlSortOrderFromRange(range); |
446 |
|
|
447 |
0 |
if (action.equals(SaveAction.ACTION_NAME)) { |
448 |
0 |
query.append("order by sum(pageSaves) " + sortOrder); |
449 |
0 |
} else if (action.equals(ViewAction.VIEW_ACTION)) { |
450 |
0 |
query.append("order by sum(pageViews) " + sortOrder); |
451 |
0 |
} else if (action.equals(DownloadAction.ACTION_NAME)) { |
452 |
0 |
query.append("order by sum(downloads) " + sortOrder); |
453 |
|
} else { |
454 |
0 |
query.append(MessageFormat.format("order by sum(pageSaves) {0}, sum(pageViews) {0}, sum(downloads) {0}", |
455 |
|
sortOrder)); |
456 |
|
} |
457 |
|
|
458 |
0 |
return query.toString(); |
459 |
|
} |
460 |
|
|
461 |
|
|
462 |
|
|
463 |
|
|
464 |
|
@param |
465 |
|
|
466 |
|
@param |
467 |
|
@param |
468 |
|
@param |
469 |
|
@return |
470 |
|
|
|
|
| 0% |
Uncovered Elements: 14 (14) |
Complexity: 3 |
Complexity Density: 0.25 |
|
471 |
0 |
public List<VisitStats> getVisitStatistics(String action, Period period, Range range, XWikiContext context)... |
472 |
|
{ |
473 |
0 |
List<VisitStats> visiStatList; |
474 |
|
|
475 |
0 |
List<Object> paramList = new ArrayList<Object>(2); |
476 |
|
|
477 |
0 |
String query = createVisitStatisticsQuery(action, period, range, paramList, context); |
478 |
|
|
479 |
0 |
XWikiHibernateStore store = context.getWiki().getHibernateStore(); |
480 |
0 |
try { |
481 |
0 |
List<?> solist = |
482 |
|
store.search(query, range.getAbsoluteSize(), range.getAbsoluteStart(), paramList, context); |
483 |
|
|
484 |
0 |
visiStatList = getVisitStatistics(solist, new DateTime(period.getStart()), new DateTime(period.getEnd())); |
485 |
0 |
if (range.getSize() < 0) { |
486 |
0 |
Collections.reverse(visiStatList); |
487 |
|
} |
488 |
|
} catch (XWikiException e) { |
489 |
0 |
LOGGER.error("Faild to search for vist statistics", e); |
490 |
|
|
491 |
0 |
visiStatList = Collections.emptyList(); |
492 |
|
} |
493 |
|
|
494 |
0 |
return visiStatList; |
495 |
|
} |
496 |
|
|
497 |
|
|
498 |
|
|
499 |
|
|
500 |
|
@param |
501 |
|
@param |
502 |
|
@param |
503 |
|
@return@link |
504 |
|
@see |
505 |
|
|
|
|
| 0% |
Uncovered Elements: 19 (19) |
Complexity: 1 |
Complexity Density: 0.05 |
|
506 |
0 |
private List<VisitStats> getVisitStatistics(List<?> resultSet, DateTime startDate, DateTime endDate)... |
507 |
|
{ |
508 |
0 |
List<VisitStats> stats = new ArrayList<VisitStats>(resultSet.size()); |
509 |
|
|
510 |
0 |
for (Object name2 : resultSet) { |
511 |
0 |
Object[] result = (Object[]) name2; |
512 |
|
|
513 |
0 |
String name = (String) result[0]; |
514 |
0 |
String uniqueID = ""; |
515 |
0 |
String cookie = ""; |
516 |
0 |
String ip = ""; |
517 |
0 |
String userAgent = ""; |
518 |
0 |
int pageSaves = ((Number) result[1]).intValue(); |
519 |
0 |
int pageViews = ((Number) result[2]).intValue(); |
520 |
0 |
int downloads = ((Number) result[3]).intValue(); |
521 |
|
|
522 |
0 |
VisitStats vs = |
523 |
|
new VisitStats(name, uniqueID, cookie, ip, userAgent, new Date(startDate.getMillis()), PeriodType.DAY); |
524 |
0 |
vs.setStartDate(new Date(startDate.getMillis())); |
525 |
0 |
vs.setEndDate(new Date(endDate.getMillis())); |
526 |
0 |
vs.setPageSaves(pageSaves); |
527 |
0 |
vs.setPageViews(pageViews); |
528 |
0 |
vs.setDownloads(downloads); |
529 |
|
|
530 |
0 |
stats.add(vs); |
531 |
|
} |
532 |
|
|
533 |
0 |
return stats; |
534 |
|
} |
535 |
|
|
536 |
|
|
537 |
|
|
538 |
|
|
539 |
|
|
540 |
|
|
541 |
|
|
542 |
|
|
543 |
|
@param |
544 |
|
@param |
545 |
|
@param |
546 |
|
@param |
547 |
|
@return |
548 |
|
@deprecated@link |
549 |
|
|
|
|
| 0% |
Uncovered Elements: 7 (7) |
Complexity: 2 |
Complexity Density: 0.29 |
|
550 |
0 |
@Deprecated... |
551 |
|
public DocumentStats getDocMonthStats(String docname, String action, Date month, XWikiContext context) |
552 |
|
{ |
553 |
0 |
XWikiHibernateStore store = context.getWiki().getHibernateStore(); |
554 |
0 |
DocumentStats object = new DocumentStats(docname, action, month, PeriodType.MONTH); |
555 |
0 |
try { |
556 |
|
|
557 |
0 |
store.loadXWikiCollection(object, context, true); |
558 |
0 |
return object; |
559 |
|
} catch (XWikiException e) { |
560 |
0 |
e.printStackTrace(); |
561 |
0 |
return new DocumentStats(); |
562 |
|
} |
563 |
|
} |
564 |
|
|
565 |
|
|
566 |
|
|
567 |
|
|
568 |
|
@param |
569 |
|
@param |
570 |
|
@param |
571 |
|
@return |
572 |
|
@throws |
573 |
|
@deprecated@link |
574 |
|
|
|
|
| 0% |
Uncovered Elements: 10 (10) |
Complexity: 2 |
Complexity Density: 0.25 |
|
575 |
0 |
@Deprecated... |
576 |
|
public List<?> getRefMonthStats(String docName, Date month, XWikiContext context) throws XWikiException |
577 |
|
{ |
578 |
0 |
XWikiHibernateStore store = context.getWiki().getHibernateStore(); |
579 |
|
|
580 |
0 |
List<?> solist; |
581 |
0 |
if (store != null) { |
582 |
0 |
List<Object> paramList = new ArrayList<Object>(1); |
583 |
0 |
paramList.add(docName); |
584 |
0 |
solist = store.search("from RefererStats as obj where obj.name=?", 0, 0, paramList, context); |
585 |
|
} else { |
586 |
0 |
solist = Collections.emptyList(); |
587 |
|
} |
588 |
|
|
589 |
0 |
return solist; |
590 |
|
} |
591 |
|
} |