Class AnalyticsScriptService

  • All Implemented Interfaces:
    org.xwiki.script.service.ScriptService

    @Component
    @Named("analytics")
    @Unstable
    @Singleton
    public class AnalyticsScriptService
    extends Object
    implements org.xwiki.script.service.ScriptService
    Script service for the Analytics Application.
    Since:
    1.0
    Version:
    $Id$
    • Constructor Detail

      • AnalyticsScriptService

        public AnalyticsScriptService()
    • 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 request
        filters - 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 order
        sortField - the field that you want to sort after
        filters - map where the keys are the fields and the values are the text that you want to filter after
        pageSize - how many elements are on a page
        pageCount - 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 format
        com.xpn.xwiki.XWikiException