Package com.xwiki.analytics.script
Class AnalyticsScriptService
- java.lang.Object
-
- com.xwiki.analytics.script.AnalyticsScriptService
-
- All Implemented Interfaces:
org.xwiki.script.service.ScriptService
@Component @Named("analytics") @Unstable @Singleton public class AnalyticsScriptService extends Object implements org.xwiki.script.service.ScriptServiceScript service for the Analytics Application.- Since:
- 1.0
- Version:
- $Id$
-
-
Constructor Summary
Constructors Constructor Description AnalyticsScriptService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaggregate(String hint)Endpoint for all the aggregator jobs.AnalyticsConfigurationgetConfiguration()org.apache.commons.lang3.tuple.Pair<Integer,List<com.fasterxml.jackson.databind.JsonNode>>handleData(String hint, String asc, String sortField, Map<String,String> filters, int pageSize, int pageCount)Endpoint for handling aggregated data for livedata.com.fasterxml.jackson.databind.JsonNodemakeRequest(Map<String,String> parameters, Map<String,String> filters, String jsonNormaliserHint)Get data from the analytics API, in normalized JSON format.
-
-
-
Method Detail
-
makeRequest
public com.fasterxml.jackson.databind.JsonNode makeRequest(Map<String,String> parameters, Map<String,String> filters, String jsonNormaliserHint)
Get data from the analytics API, in normalized JSON format.- Parameters:
parameters- a map of the parameters needed for this requestfilters- holds the criteria for filtering a dataset.jsonNormaliserHint- hint specific to the component that will normalize the response, since it's given / resulted format depends on the context were is used.- Returns:
- a normalized JSON format
-
aggregate
public void aggregate(String hint)
Endpoint for all the aggregator jobs.- Parameters:
hint- for which aggregator you want to use
-
handleData
public org.apache.commons.lang3.tuple.Pair<Integer,List<com.fasterxml.jackson.databind.JsonNode>> handleData(String hint, String asc, String sortField, Map<String,String> filters, int pageSize, int pageCount) throws com.fasterxml.jackson.core.JsonProcessingException, com.xpn.xwiki.XWikiException
Endpoint for handling aggregated data for livedata.- Parameters:
hint- for the aggregator used.asc- if you want the data to be in ascending or descending ordersortField- the field that you want to sort afterfilters- map where the keys are the fields and the values are the text that you want to filter afterpageSize- how many elements are on a pagepageCount- current page offset- Returns:
- a list with jsons
- Throws:
com.fasterxml.jackson.core.JsonProcessingException- thrown if the dataSource doesn't store the data in JSON formatcom.xpn.xwiki.XWikiException
-
getConfiguration
public AnalyticsConfiguration getConfiguration()
- Returns:
- the analytics configuration.
-
-