Search in sources :

Example 1 with XWikiStatsService

use of com.xpn.xwiki.stats.api.XWikiStatsService in project xwiki-platform by xwiki.

the class Document method getCurrentMonthRefStats.

/**
 * Get referer statistics for the current document during the current month.
 *
 * @return a list of referer statistics for the document's space
 */
public List<RefererStats> getCurrentMonthRefStats() {
    Scope scope = ScopeFactory.createPageScope(this.getFullName());
    Range range = RangeFactory.ALL;
    Period period = PeriodFactory.getCurrentMonth();
    XWikiStatsService statisticsService = getXWikiContext().getWiki().getStatsService(getXWikiContext());
    List<RefererStats> stats = statisticsService.getRefererStatistics("", scope, period, range, this.context);
    return stats;
}
Also used : RefererStats(com.xpn.xwiki.stats.impl.RefererStats) Scope(com.xpn.xwiki.criteria.impl.Scope) XWikiStatsService(com.xpn.xwiki.stats.api.XWikiStatsService) Period(com.xpn.xwiki.criteria.impl.Period) Range(com.xpn.xwiki.criteria.impl.Range)

Example 2 with XWikiStatsService

use of com.xpn.xwiki.stats.api.XWikiStatsService in project xwiki-platform by xwiki.

the class Document method getCurrentMonthPageStats.

/**
 * Get statistics about the number of request for the current page during the current month.
 *
 * @param action the type of request for which to retrieve statistics: view, edit...
 * @return the statistics object holding information for this document and the current month
 */
public DocumentStats getCurrentMonthPageStats(String action) {
    Scope scope = ScopeFactory.createPageScope(this.getFullName());
    Range range = RangeFactory.ALL;
    Period period = PeriodFactory.getCurrentMonth();
    XWikiStatsService statisticsService = getXWikiContext().getWiki().getStatsService(getXWikiContext());
    List<DocumentStats> stats = statisticsService.getDocumentStatistics(action, scope, period, range, this.context);
    if (stats.size() > 0) {
        return stats.get(0);
    }
    return new DocumentStats();
}
Also used : DocumentStats(com.xpn.xwiki.stats.impl.DocumentStats) Scope(com.xpn.xwiki.criteria.impl.Scope) XWikiStatsService(com.xpn.xwiki.stats.api.XWikiStatsService) Period(com.xpn.xwiki.criteria.impl.Period) Range(com.xpn.xwiki.criteria.impl.Range)

Example 3 with XWikiStatsService

use of com.xpn.xwiki.stats.api.XWikiStatsService in project xwiki-platform by xwiki.

the class StatsService method getVisitStatistics.

/**
 * Retrieves visit statistics.
 *
 * @param action The action the results should be ordered by. It can be one of: "view", "save" or "download". If the
 *            action is "view" then the visitors are ordered by the number of pages they have viewed so far.
 * @param period The period of time
 * @param range The sub-range to return from the entire result set. Use this parameter for pagination
 * @return A list of VisitStats objects
 */
public List<?> getVisitStatistics(String action, Period period, Range range) {
    List<?> stats = Collections.emptyList();
    XWikiStatsService statsService = getXWikiContext().getWiki().getStatsService(getXWikiContext());
    if (statsService != null) {
        stats = statsService.getVisitStatistics(action, period, range, getXWikiContext());
    }
    return stats;
}
Also used : XWikiStatsService(com.xpn.xwiki.stats.api.XWikiStatsService)

Example 4 with XWikiStatsService

use of com.xpn.xwiki.stats.api.XWikiStatsService in project xwiki-platform by xwiki.

the class StatsService method getRefererStatistics.

/**
 * Retrieves referrer statistics.
 *
 * @param domain The domain for which to retrieve statistics. To retrieve statistics for all domains use the empty
 *            string.
 * @param scope The scope of referred documents to use for filtering the results.
 * @param period The period of time
 * @param range The sub-range to return from the entire result set. Use this parameter for pagination
 * @return A list of RefererStats objects
 */
public List<?> getRefererStatistics(String domain, Scope scope, Period period, Range range) {
    List<?> stats = Collections.emptyList();
    XWikiStatsService statsService = getXWikiContext().getWiki().getStatsService(getXWikiContext());
    if (statsService != null) {
        stats = statsService.getRefererStatistics(domain, scope, period, range, getXWikiContext());
    }
    return stats;
}
Also used : XWikiStatsService(com.xpn.xwiki.stats.api.XWikiStatsService)

Example 5 with XWikiStatsService

use of com.xpn.xwiki.stats.api.XWikiStatsService in project xwiki-platform by xwiki.

the class Document method getCurrentMonthSpaceStats.

/**
 * Get statistics about the number of request for the current space during the current month.
 *
 * @param action the type of request for which to retrieve statistics: view, edit...
 * @return the statistics object holding information for the document's space and the current month
 */
public DocumentStats getCurrentMonthSpaceStats(String action) {
    Scope scope = ScopeFactory.createSpaceScope(this.doc.getSpace(), false);
    Range range = RangeFactory.ALL;
    Period period = PeriodFactory.getCurrentMonth();
    XWikiStatsService statisticsService = getXWikiContext().getWiki().getStatsService(getXWikiContext());
    List<DocumentStats> stats = statisticsService.getDocumentStatistics(action, scope, period, range, this.context);
    if (stats.size() > 0) {
        return stats.get(0);
    }
    return new DocumentStats();
}
Also used : DocumentStats(com.xpn.xwiki.stats.impl.DocumentStats) Scope(com.xpn.xwiki.criteria.impl.Scope) XWikiStatsService(com.xpn.xwiki.stats.api.XWikiStatsService) Period(com.xpn.xwiki.criteria.impl.Period) Range(com.xpn.xwiki.criteria.impl.Range)

Aggregations

XWikiStatsService (com.xpn.xwiki.stats.api.XWikiStatsService)9 Period (com.xpn.xwiki.criteria.impl.Period)3 Range (com.xpn.xwiki.criteria.impl.Range)3 Scope (com.xpn.xwiki.criteria.impl.Scope)3 DocumentStats (com.xpn.xwiki.stats.impl.DocumentStats)2 RefererStats (com.xpn.xwiki.stats.impl.RefererStats)1