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.util.Date; |
23 |
|
import java.util.List; |
24 |
|
|
25 |
|
import org.xwiki.context.Execution; |
26 |
|
import org.xwiki.context.ExecutionContext; |
27 |
|
|
28 |
|
import com.xpn.xwiki.XWikiContext; |
29 |
|
import com.xpn.xwiki.stats.impl.StatsUtil; |
30 |
|
import com.xpn.xwiki.stats.impl.StatsUtil.PeriodType; |
31 |
|
import com.xpn.xwiki.web.Utils; |
32 |
|
|
33 |
|
|
34 |
|
@link |
35 |
|
|
36 |
|
@version |
37 |
|
@since |
38 |
|
|
|
|
| 0% |
Uncovered Elements: 13 (13) |
Complexity: 2 |
Complexity Density: 0.18 |
|
39 |
|
public abstract class AbstractStatsStoreItem implements XWikiStatsStoreItem |
40 |
|
{ |
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
protected XWikiContext context; |
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
protected String name; |
50 |
|
|
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
protected Date periodDate; |
55 |
|
|
56 |
|
|
57 |
|
|
58 |
|
|
59 |
|
protected PeriodType periodType; |
60 |
|
|
61 |
|
|
62 |
|
|
63 |
|
|
64 |
|
protected int period; |
65 |
|
|
66 |
|
|
67 |
|
@param |
68 |
|
@param |
69 |
|
@param |
70 |
|
@param |
71 |
|
|
|
|
| 0% |
Uncovered Elements: 5 (5) |
Complexity: 1 |
Complexity Density: 0.2 |
|
72 |
0 |
public AbstractStatsStoreItem(String name, Date periodDate, PeriodType periodType, XWikiContext context)... |
73 |
|
{ |
74 |
0 |
this.name = name; |
75 |
|
|
76 |
0 |
this.periodDate = periodDate; |
77 |
0 |
this.periodType = periodType; |
78 |
0 |
this.period = StatsUtil.getPeriodAsInt(this.periodDate, this.periodType); |
79 |
|
|
80 |
0 |
this.context = context.clone(); |
81 |
|
} |
82 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 1 |
Complexity Density: 0.17 |
|
83 |
0 |
@Override... |
84 |
|
public void store(List<XWikiStatsStoreItem> statsList) |
85 |
|
{ |
86 |
0 |
ExecutionContext econtext = Utils.getComponent(Execution.class).getContext(); |
87 |
|
|
88 |
0 |
XWikiContext currentContext = (XWikiContext) econtext.getProperty(XWikiContext.EXECUTIONCONTEXT_KEY); |
89 |
|
|
90 |
0 |
try { |
91 |
0 |
econtext.setProperty(XWikiContext.EXECUTIONCONTEXT_KEY, this.context); |
92 |
|
|
93 |
0 |
storeInternal(statsList); |
94 |
|
} finally { |
95 |
0 |
econtext.setProperty(XWikiContext.EXECUTIONCONTEXT_KEY, currentContext); |
96 |
|
} |
97 |
|
} |
98 |
|
|
99 |
|
|
100 |
|
|
101 |
|
|
102 |
|
@param |
103 |
|
@since |
104 |
|
|
105 |
|
protected abstract void storeInternal(List<XWikiStatsStoreItem> statsList); |
106 |
|
} |