Class | Line # | Actions | |||||
---|---|---|---|---|---|---|---|
XWikiStatsService | 42 | 0 | - | 0 | 0 |
1 | /* | |
2 | * See the NOTICE file distributed with this work for additional | |
3 | * information regarding copyright ownership. | |
4 | * | |
5 | * This is free software; you can redistribute it and/or modify it | |
6 | * under the terms of the GNU Lesser General Public License as | |
7 | * published by the Free Software Foundation; either version 2.1 of | |
8 | * the License, or (at your option) any later version. | |
9 | * | |
10 | * This software is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
13 | * Lesser General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU Lesser General Public | |
16 | * License along with this software; if not, write to the Free | |
17 | * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA | |
18 | * 02110-1301 USA, or see the FSF site: http://www.fsf.org. | |
19 | */ | |
20 | package com.xpn.xwiki.stats.api; | |
21 | ||
22 | import java.util.Collection; | |
23 | import java.util.Date; | |
24 | import java.util.List; | |
25 | import java.util.Map; | |
26 | ||
27 | import com.xpn.xwiki.XWikiContext; | |
28 | import com.xpn.xwiki.XWikiException; | |
29 | import com.xpn.xwiki.criteria.impl.Duration; | |
30 | import com.xpn.xwiki.criteria.impl.Period; | |
31 | import com.xpn.xwiki.criteria.impl.Range; | |
32 | import com.xpn.xwiki.criteria.impl.Scope; | |
33 | import com.xpn.xwiki.stats.impl.DocumentStats; | |
34 | import com.xpn.xwiki.stats.impl.RefererStats; | |
35 | import com.xpn.xwiki.stats.impl.VisitStats; | |
36 | ||
37 | /** | |
38 | * Store and retrieve statistics. | |
39 | * | |
40 | * @version $Id: 23b74093eea7f74218875d12be942cef51f7747d $ | |
41 | */ | |
42 | public interface XWikiStatsService | |
43 | { | |
44 | /** | |
45 | * Methods called just one time at XWiki initialization. | |
46 | * | |
47 | * @param context the XWiki context. | |
48 | */ | |
49 | void init(XWikiContext context); | |
50 | ||
51 | /** | |
52 | * Return the statistics action stored. | |
53 | * | |
54 | * @param action the action. | |
55 | * @param size the maximum size of the list to return. | |
56 | * @param context the XWiki context. | |
57 | * @return the list of recent statistics action stored. | |
58 | */ | |
59 | Collection<?> getRecentActions(String action, int size, XWikiContext context); | |
60 | ||
61 | /** | |
62 | * Retrieves document statistics. | |
63 | * | |
64 | * @param action the action the results should be ordered by. It can be one of: "view", "save" or "download". If the | |
65 | * action is "view" then the documents are ordered by the number of times they have been viewed so far. | |
66 | * @param scope the set of documents for which to retrieve statistics. | |
67 | * @param period the period of time. | |
68 | * @param range the sub-range to return from the entire result set. Use this parameter for pagination. | |
69 | * @param context the XWiki context. | |
70 | * @return A list of DocumentStats objects | |
71 | */ | |
72 | List<DocumentStats> getDocumentStatistics(String action, Scope scope, Period period, Range range, | |
73 | XWikiContext context); | |
74 | ||
75 | /** | |
76 | * Retrieves visit statistics. | |
77 | * | |
78 | * @param action the action the results should be ordered by. It can be one of: "view", "save" or "download". If the | |
79 | * action is "view" then the visitors are ordered by the number of pages they have viewed so far. | |
80 | * @param period the period of time. | |
81 | * @param range the sub-range to return from the entire result set. Use this parameter for pagination. | |
82 | * @param context the XWiki context. | |
83 | * @return a list of VisitStats objects. | |
84 | */ | |
85 | List<VisitStats> getVisitStatistics(String action, Period period, Range range, XWikiContext context); | |
86 | ||
87 | /** | |
88 | * Retrieves referrer statistics. | |
89 | * | |
90 | * @param domain the domain for which to retrieve statistics. To retrieve statistics for all domains use the empty | |
91 | * string. | |
92 | * @param scope the scope of referred documents to use for filtering the results. | |
93 | * @param period the period of time. | |
94 | * @param range the sub-range to return from the entire result set. Use this parameter for pagination. | |
95 | * @param context the XWiki context. | |
96 | * @return a list of RefererStats objects. | |
97 | */ | |
98 | List<RefererStats> getRefererStatistics(String domain, Scope scope, Period period, Range range, | |
99 | XWikiContext context); | |
100 | ||
101 | /** | |
102 | * Retrieves back-link statistics. | |
103 | * | |
104 | * @param domain the domain used for filtering the results. | |
105 | * @param scope the scope of referred documents for which to retrieve statistics. | |
106 | * @param period the period of time. | |
107 | * @param range the sub-range to return from the entire result set. Use this parameter for pagination. | |
108 | * @param context the XWiki context. | |
109 | * @return a list of DocumentStats objects. | |
110 | */ | |
111 | List<?> getBackLinkStatistics(String domain, Scope scope, Period period, Range range, XWikiContext context); | |
112 | ||
113 | /** | |
114 | * Shows how the statistics for the specified action have evolved over the specified period of time. | |
115 | * | |
116 | * @param action the action for which to retrieve statistics. | |
117 | * @param scope the set of documents to consider. | |
118 | * @param period the period of time. | |
119 | * @param step the step used for sampling the period. | |
120 | * @param context the XWiki context. | |
121 | * @return a map of (date, actionCount) pairs. | |
122 | */ | |
123 | Map<?, ?> getActionStatistics(String action, Scope scope, Period period, Duration step, XWikiContext context); | |
124 | ||
125 | // //////////////////////////////////////////////////////////////////////////////////////// | |
126 | // Deprecated methods | |
127 | // //////////////////////////////////////////////////////////////////////////////////////// | |
128 | ||
129 | /** | |
130 | * Gets total statistics on a document for a specific action. | |
131 | * | |
132 | * @param docname fully qualified document name. | |
133 | * @param action can be "view", "edit", "save", etc.. | |
134 | * @param context the XWiki context. | |
135 | * @return DocumentStats - statistics object. | |
136 | * @deprecated use {@link #getDocumentStatistics(String, Scope, Period, Range , XWikiContext)} instead. | |
137 | */ | |
138 | @Deprecated | |
139 | DocumentStats getDocTotalStats(String docname, String action, XWikiContext context); | |
140 | ||
141 | /** | |
142 | * Gets monthly statistics on a document for a specific action. | |
143 | * | |
144 | * @param docname fully qualified document name. | |
145 | * @param action can be "view", "edit", "save", etc.. | |
146 | * @param month the month. | |
147 | * @param context the XWiki context. | |
148 | * @return DocumentStats - statistics object. | |
149 | * @deprecated use {@link #getDocumentStatistics(String, Scope, Period, Range , XWikiContext)} instead. | |
150 | */ | |
151 | @Deprecated | |
152 | DocumentStats getDocMonthStats(String docname, String action, Date month, XWikiContext context); | |
153 | ||
154 | /** | |
155 | * Gets day statistics on a document for a specific action. | |
156 | * | |
157 | * @param docname fully qualified document name. | |
158 | * @param action can be "view", "edit", "save", etc.. | |
159 | * @param day the day. | |
160 | * @param context the XWiki context. | |
161 | * @return DocumentStats - statistics object. | |
162 | * @deprecated use {@link #getDocumentStatistics(String, Scope, Period, Range , XWikiContext)} instead. | |
163 | */ | |
164 | @Deprecated | |
165 | DocumentStats getDocDayStats(String docname, String action, Date day, XWikiContext context); | |
166 | ||
167 | /** | |
168 | * Gets monthly referer statistics. | |
169 | * | |
170 | * @param docName fully qualified document name. | |
171 | * @param month the month. | |
172 | * @param context the XWiki context. | |
173 | * @return the monthly referer statistics. | |
174 | * @throws XWikiException error when searching for referer statistics. | |
175 | * @deprecated use {@link #getRefererStatistics(String, Scope, Period, Range, XWikiContext)} instead. | |
176 | */ | |
177 | @Deprecated | |
178 | List getRefMonthStats(String docName, Date month, XWikiContext context) throws XWikiException; | |
179 | } |