com.jalios.jcms.analytics
Class AnalyticsManager

java.lang.Object
  extended by com.jalios.jcms.analytics.AnalyticsManager
All Implemented Interfaces:
JPropertiesListener

public class AnalyticsManager
extends Object
implements JPropertiesListener

AnalyticsManager use for JCMS analytics


Nested Class Summary
static class AnalyticsManager.ContentTopMapComparator
           
 class AnalyticsManager.dataMixInFilter
           
 class AnalyticsManager.DoubleEntryComparator
           
 class AnalyticsManager.DoubleMapComparator
           
 class AnalyticsManager.MemberMixInFilter
           
 class AnalyticsManager.TopDoubleMapComparator
           
 class AnalyticsManager.TopMapComparator
           
 
Field Summary
static String AC_SEARCH
           
static String ACCESS
           
static String ANALYTICS_RESOLVEHOST_PROP
           
static String AUDIENCEMENT
           
static String AUTH_FAIL
           
static String BOT_PROP
           
static String BROWSER
           
static String BROWSERS_PROP
           
static String Chrome
           
static String CORE
           
static String COUNTRY
           
static String CSRF_ERROR
           
static String CTXTCAT
           
static String CURRENTCAT
           
static String DATA
           
static String DATA_TYPE
           
static String DATA_WORKSPACES
           
static DateFormat DATE_FORMAT
           
static String DATEEND
           
static String DATESTART
           
static String DOWNLOAD
           
static String GROUPS
           
static String IPADDRESS
           
static String IS_BOT
           
static String LANGUAGE
           
static String LOCALE
           
static String MEMBER
           
static String MEMO
           
static String METHODE
           
static String NAME
           
static String OLD_DATA_WORKSPACES
           
static String OPENAPI
           
static String OPENAPI_DISABLED
           
static String OPENAPI_ERROR
           
static String OPENAPI_OK
           
static String OPENAPI_READ_ACCESS_DISABLED
           
static String OPENAPI_READ_ACCESS_FORBIDDEN
           
static String OPENAPI_UNAVAILABLE
           
static String OPENAPI_WRITE_ACCESS_DISABLED
           
static String OPENAPI_WRITE_ACCESS_FORBIDDEN
           
static String OS
           
static String OS_PROP
           
static org.apache.oro.text.regex.Pattern PATTERN_BOT
           
static org.apache.oro.text.regex.Pattern PATTERN_BROWSER
           
static int PATTERN_NOT_PROCESSED
           
static org.apache.oro.text.regex.Pattern PATTERN_OS
           
static int PATTERN_PROCESSED_FALSE
           
static int PATTERN_PROCESSED_TRUE
           
static String PORTAL
           
static String PORTAL_TITLE
           
static String PORTALCAT
           
static String PRINT_VIEW
           
static String PUBLICATION
           
static String QUERYSTRING
           
static String REFERER
           
static String Safari
           
static String SCHEME
           
static String SEARCH_CATEGORY
           
static String SEARCH_FULLTEXT
           
static String SEARCH_GROUPS
           
static String SEARCH_HIST
           
static String SEARCH_MEMBERS
           
static String SEARCH_SORT
           
static String SEARCH_TYPES
           
static String SERVERNAME
           
static String SERVERPORT
           
static String SESSIONID
           
static String URI
           
static String URID
           
static String USERAGENT
           
static String WORKSPACE
           
static String XFORWARD
           
static String ZONE
           
 
Fields inherited from interface com.jalios.util.JPropertiesListener
REVISION
 
Method Summary
 void addAgent(AbstractStatisticAgent agent)
          add a AbstractStatisticAgent to agent list
static Set<AbstractReportMetric> aggregateAllUrid(Set<AbstractReportMetric> originalSet, Class<? extends AbstractReportMetric> clazz)
          Aggregate all urid report in global report (day by day)
static void aggregateDateKeyDoubleMap(Map<Date,Double> origMap, Map<Date,Double> mapToAdd)
           
static void aggregateKeyContentTopMap(Map<String,ContentTopValue> origContentTopMap, Map<String,ContentTopValue> mapToAdd)
           
static void aggregateKeyIntegerMap(Map<String,Integer> origMap, Map<String,Integer> mapToAdd)
           
static void aggregateKeyLongMap(Map<String,Long> origMap, Map<String,Long> mapToAdd)
           
static void appendEventData(EventData eventData)
          Append a data event
static void appendEventData(EventData eventData, javax.servlet.http.HttpServletRequest request)
          Append a data event
static void appendEventData(EventData eventData, javax.servlet.http.HttpServletRequest request, File eventDirectory)
          Append a data event
static void appendPageEvent(javax.servlet.http.HttpServletRequest request, long startPageRequest)
          Append a page event (like previous page stat mechanism)
protected static void appendPageEvent(javax.servlet.http.HttpServletRequest request, long startPageRequest, long endPageRequest, long eventDate, File eventDirectory)
          Append a page event (like previous page stat mechanism)
static void completeMetricObjectSet(Set<AbstractReportMetric> originalSet, Date startDate, Date endDate, Locale locale, Class<? extends AbstractReportMetric> clazz)
          Update the provided set with some empty report metric instance if any are missing in specified interval
 void deleteAnalyze(AnalyzeListener listener)
          Delete a AnalyzeListener from the current AnalyzeListener List
static Map<String,String> generateAccessContextMap(javax.servlet.http.HttpServletRequest request, EventData eventData)
           
static String getActionFromOp(int opAction)
           
 List<AbstractStatisticAgent> getAgents()
          Get AbstractStatisticAgent list (a copy of internal agent list)
static SortedSet<String> getBots(String userAgent)
           
static SortedSet<String> getBrowsers(String userAgent)
           
static Set<Workspace> getCompatibleWorkspaceSet()
          Get compatible workspaces for analyze (workspace model are ignored) (without any right check)
static Set<Workspace> getCompatibleWorkspaceSet(Member loggedMember)
          Get compatible workspaces for analyze (workspace model are ignored)
 List<AnalyzeListener> getCurrentAnalyzeListener()
          Retrieve the current analyze listener
static Map<String,ContentTopValue> getDeserializedContentTopMap(Map<String,String> contentTopMap)
          Convert a Map of String to map of ContentTopValue
 File getEventDirectory()
          Retrieve event data directory
 File getEventFile(File directory, Date date)
          Retrieve event data file for a date
static AnalyticsManager getInstance()
           
 org.codehaus.jackson.map.ObjectMapper getObjectMapper()
          get the ObjectMapper (cached in the class)
 Map<String,String> getRequestCustomContextMap(javax.servlet.http.HttpServletRequest request)
          Get the context Map which will be merge with existing context if it exists before writing EventData
static Map<String,String> getSerializedContentTopMap(Map<String,ContentTopValue> contentTopMap)
          Convert a Map of ContentTopValue to map of String
static SortedMap<String,ContentTopValue> getSortedContentTopMap(Map<String,ContentTopValue> origContentTopMap, int nbMaxElt)
           
 SortedMap<String,Double> getSortedTopDoubleMap(Map<String,Double> topMap, int nbMaxElt)
           
 SortedMap<String,Integer> getSortedTopMap(Map<String,Integer> topMap, int nbMaxElt)
           
 Map<String,String> getThreadLocalCustomContextMap()
          Get the context Map which will be merge with existing context if it exists before writing EventData context map will be get from a ThreadLocal object
static String getUrlSubString(String value, int maxLength)
           
static Calendar getUtcTime(Date reportDate, Locale userLocale)
          Retrieve a UTC time from a date
 void initAlarms()
          init analytics alarm use to compute day aggregation
static boolean isBot(EventData data)
           
static boolean isValidOperationAction(String opAction)
           
static Map<String,Map<Date,Double>> keptBest(Map<String,Map<Date,Double>> dataMap, int nbElement, String othersKey)
          Compute a new map by top x data and grouping other data.
static Map<String,Map<Date,Double>> normalizeMap(Map<String,Map<Date,Double>> dataMap)
          Normalize a Map> Map to have value in percentage day by day
static void processQueries(Map<String,String> ctxMap)
           
 void propertiesChange(JProperties properties)
          Invoked after properties have been modified in JCMS and save on disk.
 List<EventData> readEventFile(File file)
          Read EventData from a file
 void reinitAlarms()
          ReinitAlarms (remove all analytics alarms from analytics alarm manager and init alarms)
 void removeAgent(AbstractStatisticAgent agent)
          remove a AbstractStatisticAgent from agent list
static void removeToDayMetric(Set<AbstractReportMetric> originalSet)
          Remove today metric, because this metric is not done.
 void runDayAgent()
          run day agent with management of missing aggregation (manual run)
 void runDayAgent(Date startDate, Date endDate, Set<Workspace> workspaceSet, String urid, File eventDirectory, Set<AbstractStatisticAgent> dayAgentList, boolean scheduled, boolean globalAnalyze)
          Run day agent in a specific period
 void runDayAgent(Date startDate, Date endDate, Workspace workspace, String urid, boolean scheduled, boolean globalAnalyze)
          Run day agent in a specific period
 void runDayAgentFromAlarm()
          run day agent with management of missing aggregation (from an alarm).
 String serializeEvent(EventData data)
          Serialize an EventData in a string
static String toJSON(Object obj)
           
 void writeEvent(EventData data)
          Write an EventData in the file
 void writeEvent(File eventDirectory, EventData data)
          Write an EventData in the file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ANALYTICS_RESOLVEHOST_PROP

public static final String ANALYTICS_RESOLVEHOST_PROP
See Also:
Constant Field Values

Safari

public static final String Safari
See Also:
Constant Field Values

Chrome

public static final String Chrome
See Also:
Constant Field Values

DOWNLOAD

public static final String DOWNLOAD
See Also:
Constant Field Values

IPADDRESS

public static final String IPADDRESS
See Also:
Constant Field Values

METHODE

public static final String METHODE
See Also:
Constant Field Values

REFERER

public static final String REFERER
See Also:
Constant Field Values

SCHEME

public static final String SCHEME
See Also:
Constant Field Values

SERVERNAME

public static final String SERVERNAME
See Also:
Constant Field Values

URI

public static final String URI
See Also:
Constant Field Values

QUERYSTRING

public static final String QUERYSTRING
See Also:
Constant Field Values

SESSIONID

public static final String SESSIONID
See Also:
Constant Field Values

USERAGENT

public static final String USERAGENT
See Also:
Constant Field Values

ZONE

public static final String ZONE
See Also:
Constant Field Values

MEMO

public static final String MEMO
See Also:
Constant Field Values

NAME

public static final String NAME
See Also:
Constant Field Values

SERVERPORT

public static final String SERVERPORT
See Also:
Constant Field Values

LOCALE

public static final String LOCALE
See Also:
Constant Field Values

DATESTART

public static final String DATESTART
See Also:
Constant Field Values

DATEEND

public static final String DATEEND
See Also:
Constant Field Values

DATA

public static final String DATA
See Also:
Constant Field Values

DATA_TYPE

public static final String DATA_TYPE
See Also:
Constant Field Values

MEMBER

public static final String MEMBER
See Also:
Constant Field Values

GROUPS

public static final String GROUPS
See Also:
Constant Field Values

PORTAL

public static final String PORTAL
See Also:
Constant Field Values

PORTAL_TITLE

public static final String PORTAL_TITLE
See Also:
Constant Field Values

WORKSPACE

public static final String WORKSPACE
See Also:
Constant Field Values

CURRENTCAT

public static final String CURRENTCAT
See Also:
Constant Field Values

PORTALCAT

public static final String PORTALCAT
See Also:
Constant Field Values

CTXTCAT

public static final String CTXTCAT
See Also:
Constant Field Values

PUBLICATION

public static final String PUBLICATION
See Also:
Constant Field Values

BROWSER

public static final String BROWSER
See Also:
Constant Field Values

OS

public static final String OS
See Also:
Constant Field Values

COUNTRY

public static final String COUNTRY
See Also:
Constant Field Values

LANGUAGE

public static final String LANGUAGE
See Also:
Constant Field Values

SEARCH_FULLTEXT

public static final String SEARCH_FULLTEXT
See Also:
Constant Field Values

SEARCH_CATEGORY

public static final String SEARCH_CATEGORY
See Also:
Constant Field Values

SEARCH_GROUPS

public static final String SEARCH_GROUPS
See Also:
Constant Field Values

SEARCH_MEMBERS

public static final String SEARCH_MEMBERS
See Also:
Constant Field Values

SEARCH_TYPES

public static final String SEARCH_TYPES
See Also:
Constant Field Values

SEARCH_SORT

public static final String SEARCH_SORT
See Also:
Constant Field Values

SEARCH_HIST

public static final String SEARCH_HIST
See Also:
Constant Field Values

URID

public static final String URID
See Also:
Constant Field Values

AUDIENCEMENT

public static final String AUDIENCEMENT
See Also:
Constant Field Values

XFORWARD

public static final String XFORWARD
See Also:
Constant Field Values

PRINT_VIEW

public static final String PRINT_VIEW
See Also:
Constant Field Values

IS_BOT

public static final String IS_BOT
See Also:
Constant Field Values

DATA_WORKSPACES

public static final String DATA_WORKSPACES
See Also:
Constant Field Values

OLD_DATA_WORKSPACES

public static final String OLD_DATA_WORKSPACES
See Also:
Constant Field Values

PATTERN_NOT_PROCESSED

public static final int PATTERN_NOT_PROCESSED
See Also:
Constant Field Values

PATTERN_PROCESSED_TRUE

public static final int PATTERN_PROCESSED_TRUE
See Also:
Constant Field Values

PATTERN_PROCESSED_FALSE

public static final int PATTERN_PROCESSED_FALSE
See Also:
Constant Field Values

BROWSERS_PROP

public static final String BROWSERS_PROP

OS_PROP

public static final String OS_PROP

BOT_PROP

public static final String BOT_PROP

PATTERN_BOT

public static final org.apache.oro.text.regex.Pattern PATTERN_BOT

PATTERN_BROWSER

public static final org.apache.oro.text.regex.Pattern PATTERN_BROWSER

PATTERN_OS

public static final org.apache.oro.text.regex.Pattern PATTERN_OS

CORE

public static final String CORE
See Also:
Constant Field Values

ACCESS

public static final String ACCESS
See Also:
Constant Field Values

OPENAPI

public static final String OPENAPI
See Also:
Constant Field Values

AC_SEARCH

public static final String AC_SEARCH
See Also:
Constant Field Values

CSRF_ERROR

public static final String CSRF_ERROR
See Also:
Constant Field Values

AUTH_FAIL

public static final String AUTH_FAIL
See Also:
Constant Field Values

OPENAPI_UNAVAILABLE

public static final String OPENAPI_UNAVAILABLE
See Also:
Constant Field Values

OPENAPI_DISABLED

public static final String OPENAPI_DISABLED
See Also:
Constant Field Values

OPENAPI_ERROR

public static final String OPENAPI_ERROR
See Also:
Constant Field Values

OPENAPI_READ_ACCESS_DISABLED

public static final String OPENAPI_READ_ACCESS_DISABLED
See Also:
Constant Field Values

OPENAPI_READ_ACCESS_FORBIDDEN

public static final String OPENAPI_READ_ACCESS_FORBIDDEN
See Also:
Constant Field Values

OPENAPI_WRITE_ACCESS_DISABLED

public static final String OPENAPI_WRITE_ACCESS_DISABLED
See Also:
Constant Field Values

OPENAPI_WRITE_ACCESS_FORBIDDEN

public static final String OPENAPI_WRITE_ACCESS_FORBIDDEN
See Also:
Constant Field Values

OPENAPI_OK

public static final String OPENAPI_OK
See Also:
Constant Field Values

DATE_FORMAT

public static final DateFormat DATE_FORMAT
Method Detail

getInstance

public static AnalyticsManager getInstance()

propertiesChange

public void propertiesChange(JProperties properties)
Description copied from interface: JPropertiesListener
Invoked after properties have been modified in JCMS and save on disk.

You cannot alter the value received in parameters.

Specified by:
propertiesChange in interface JPropertiesListener
Parameters:
properties - the properties which have been modified (may not contain all JCMS properties)

writeEvent

public void writeEvent(EventData data)
                throws org.codehaus.jackson.JsonGenerationException,
                       org.codehaus.jackson.map.JsonMappingException,
                       IOException
Write an EventData in the file

Parameters:
data - the EventData
Throws:
org.codehaus.jackson.JsonGenerationException - Exception thrown when eventData is save as JSON data
org.codehaus.jackson.map.JsonMappingException - Exception thrown when eventData is save as JSON data
IOException - Exception thrown when eventData is save as JSON data

writeEvent

public void writeEvent(File eventDirectory,
                       EventData data)
                throws org.codehaus.jackson.JsonGenerationException,
                       org.codehaus.jackson.map.JsonMappingException,
                       IOException
Write an EventData in the file

Parameters:
eventDirectory - the events data directory
data - the EventData
Throws:
org.codehaus.jackson.JsonGenerationException - Exception thrown when eventData is save as JSON data
org.codehaus.jackson.map.JsonMappingException - Exception thrown when eventData is save as JSON data
IOException - Exception thrown when eventData is save as JSON data

serializeEvent

public String serializeEvent(EventData data)
                      throws org.codehaus.jackson.JsonGenerationException,
                             org.codehaus.jackson.map.JsonMappingException,
                             IOException
Serialize an EventData in a string

Parameters:
data - the EventData
Returns:
the JSON value
Throws:
org.codehaus.jackson.JsonGenerationException - Exception thrown when eventData is save as JSON data
org.codehaus.jackson.map.JsonMappingException - Exception thrown when eventData is save as JSON data
IOException - Exception thrown when eventData is save as JSON data

readEventFile

public List<EventData> readEventFile(File file)
                              throws IOException
Read EventData from a file

Parameters:
file - the file to read
Returns:
the list of EventData
Throws:
IOException - Exception thrown when reading the file

getEventDirectory

public File getEventDirectory()
Retrieve event data directory

Returns:
the File

getEventFile

public File getEventFile(File directory,
                         Date date)
Retrieve event data file for a date

Parameters:
date - the date used to compute the filename
directory - the directory File
Returns:
the File

getObjectMapper

public org.codehaus.jackson.map.ObjectMapper getObjectMapper()
get the ObjectMapper (cached in the class)

Returns:
the ObjectMapper

addAgent

public void addAgent(AbstractStatisticAgent agent)
add a AbstractStatisticAgent to agent list

Parameters:
agent - the AbstractStatisticAgent to add

removeAgent

public void removeAgent(AbstractStatisticAgent agent)
remove a AbstractStatisticAgent from agent list

Parameters:
agent - the AbstractStatisticAgent to remove

getAgents

public List<AbstractStatisticAgent> getAgents()
Get AbstractStatisticAgent list (a copy of internal agent list)

Returns:
the copy of internal agent list

getRequestCustomContextMap

public Map<String,String> getRequestCustomContextMap(javax.servlet.http.HttpServletRequest request)
Get the context Map which will be merge with existing context if it exists before writing EventData

Parameters:
request - the current HttpServletRequest (if null, context map will be get from a ThreadLocal object)
Returns:
the context Map

getThreadLocalCustomContextMap

public Map<String,String> getThreadLocalCustomContextMap()
Get the context Map which will be merge with existing context if it exists before writing EventData context map will be get from a ThreadLocal object

Returns:
the context Map

appendEventData

public static void appendEventData(EventData eventData)
                            throws org.codehaus.jackson.JsonGenerationException,
                                   org.codehaus.jackson.map.JsonMappingException,
                                   IOException
Append a data event

Parameters:
eventData - the EventData to save. Context map will be extended if getRequestCustomContextMap(HttpServletRequest) or getThreadLocalCustomContextMap() contains something
Throws:
org.codehaus.jackson.JsonGenerationException - thrown when saving EventData
org.codehaus.jackson.map.JsonMappingException - thrown when saving EventData
IOException - thrown when saving EventData

appendEventData

public static void appendEventData(EventData eventData,
                                   javax.servlet.http.HttpServletRequest request)
                            throws org.codehaus.jackson.JsonGenerationException,
                                   org.codehaus.jackson.map.JsonMappingException,
                                   IOException
Append a data event

Parameters:
eventData - the EventData to save. Context map will be extended if getRequestCustomContextMap(HttpServletRequest) or getThreadLocalCustomContextMap() contains something
request - the current HttpServletRequest used to get extendedContextMap. See getRequestCustomContextMap(HttpServletRequest) for more information
Throws:
org.codehaus.jackson.JsonGenerationException - thrown when saving EventData
org.codehaus.jackson.map.JsonMappingException - thrown when saving EventData
IOException - thrown when saving EventData

appendEventData

public static void appendEventData(EventData eventData,
                                   javax.servlet.http.HttpServletRequest request,
                                   File eventDirectory)
                            throws org.codehaus.jackson.JsonGenerationException,
                                   org.codehaus.jackson.map.JsonMappingException,
                                   IOException
Append a data event

Parameters:
eventData - the EventData to save. Context map will be extended if getRequestCustomContextMap(HttpServletRequest) or getThreadLocalCustomContextMap() contains something
request - the current HttpServletRequest used to get extendedContextMap getRequestCustomContextMap(HttpServletRequest) for more information
eventDirectory - the directory in which event should be saved
Throws:
org.codehaus.jackson.JsonGenerationException - thrown when saving EventData
org.codehaus.jackson.map.JsonMappingException - thrown when saving EventData
IOException - thrown when saving EventData

appendPageEvent

public static void appendPageEvent(javax.servlet.http.HttpServletRequest request,
                                   long startPageRequest)
                            throws org.codehaus.jackson.JsonGenerationException,
                                   org.codehaus.jackson.map.JsonMappingException,
                                   IOException
Append a page event (like previous page stat mechanism)

Parameters:
request - the current HttpServletRequest
startPageRequest - the start time of the page request
Throws:
org.codehaus.jackson.JsonGenerationException - thrown when saving EventData
org.codehaus.jackson.map.JsonMappingException - thrown when saving EventData
IOException - thrown when saving EventData

appendPageEvent

protected static void appendPageEvent(javax.servlet.http.HttpServletRequest request,
                                      long startPageRequest,
                                      long endPageRequest,
                                      long eventDate,
                                      File eventDirectory)
                               throws org.codehaus.jackson.JsonGenerationException,
                                      org.codehaus.jackson.map.JsonMappingException,
                                      IOException
Append a page event (like previous page stat mechanism)

Parameters:
request - the current HttpServletRequestr
startPageRequest - the start time of the page request
endPageRequest - the end time of the page request
eventDate - the Date of the event
eventDirectory - the directory in which event should be saved
Throws:
org.codehaus.jackson.JsonGenerationException - thrown when saving EventData
org.codehaus.jackson.map.JsonMappingException - thrown when saving EventData
IOException - thrown when saving EventData

generateAccessContextMap

public static Map<String,String> generateAccessContextMap(javax.servlet.http.HttpServletRequest request,
                                                          EventData eventData)

getBrowsers

public static SortedSet<String> getBrowsers(String userAgent)

getBots

public static SortedSet<String> getBots(String userAgent)

processQueries

public static void processQueries(Map<String,String> ctxMap)

runDayAgent

public void runDayAgent(Date startDate,
                        Date endDate,
                        Workspace workspace,
                        String urid,
                        boolean scheduled,
                        boolean globalAnalyze)
Run day agent in a specific period

Parameters:
startDate - the start day of the period
endDate - the end day of the period
workspace - Workspace to limit analyze (null for all workspaces)
urid - the urid used in analysis
scheduled - is the run a manual run or from a schedule (alarm)
globalAnalyze - do global analyze (workspace == null in agent and report)

runDayAgent

public void runDayAgent(Date startDate,
                        Date endDate,
                        Set<Workspace> workspaceSet,
                        String urid,
                        File eventDirectory,
                        Set<AbstractStatisticAgent> dayAgentList,
                        boolean scheduled,
                        boolean globalAnalyze)
Run day agent in a specific period

Parameters:
startDate - the start day of the period
endDate - the end day of the period
urid - the urid used in analysis
workspaceSet - Workspace Set to limit analyze (null for all workspaces)
eventDirectory - the directory in which events file are present
dayAgentList - Set of agent to run
scheduled - is the run a manual run or from alarm
globalAnalyze - do global analyze (workspace == null in agent and report)

getCurrentAnalyzeListener

public List<AnalyzeListener> getCurrentAnalyzeListener()
Retrieve the current analyze listener

Returns:
the List of AnalyzeListener

deleteAnalyze

public void deleteAnalyze(AnalyzeListener listener)
Delete a AnalyzeListener from the current AnalyzeListener List

Parameters:
listener - the AnalyzeListener to remove

initAlarms

public void initAlarms()
init analytics alarm use to compute day aggregation


reinitAlarms

public void reinitAlarms()
ReinitAlarms (remove all analytics alarms from analytics alarm manager and init alarms)


runDayAgentFromAlarm

public void runDayAgentFromAlarm()
run day agent with management of missing aggregation (from an alarm).


runDayAgent

public void runDayAgent()
run day agent with management of missing aggregation (manual run)


getUtcTime

public static Calendar getUtcTime(Date reportDate,
                                  Locale userLocale)
Retrieve a UTC time from a date

Parameters:
reportDate - the date
userLocale - the locale
Returns:
the UTC time

completeMetricObjectSet

public static void completeMetricObjectSet(Set<AbstractReportMetric> originalSet,
                                           Date startDate,
                                           Date endDate,
                                           Locale locale,
                                           Class<? extends AbstractReportMetric> clazz)
                                    throws InstantiationException,
                                           IllegalAccessException
Update the provided set with some empty report metric instance if any are missing in specified interval

Parameters:
originalSet - the original Set of AbstractReportMetric
startDate - the start date of the interval
endDate - the end date of the interval
locale - the current locale (used to compute Calendar object)
clazz - AbstractReportMetric subclass to instantiate
Throws:
IllegalAccessException - Exception thrown during the execution
InstantiationException - Exception thrown during the execution

aggregateAllUrid

public static Set<AbstractReportMetric> aggregateAllUrid(Set<AbstractReportMetric> originalSet,
                                                         Class<? extends AbstractReportMetric> clazz)
                                                  throws InstantiationException,
                                                         IllegalAccessException
Aggregate all urid report in global report (day by day)

Parameters:
originalSet - the original Set of AbstractReportMetric
clazz - AbstractReportMetric subclass to instantiate
Returns:
the new Set with report aggregated
Throws:
IllegalAccessException - Exception thrown during the execution
InstantiationException - Exception thrown during the execution

aggregateKeyIntegerMap

public static void aggregateKeyIntegerMap(Map<String,Integer> origMap,
                                          Map<String,Integer> mapToAdd)

aggregateKeyLongMap

public static void aggregateKeyLongMap(Map<String,Long> origMap,
                                       Map<String,Long> mapToAdd)

aggregateDateKeyDoubleMap

public static void aggregateDateKeyDoubleMap(Map<Date,Double> origMap,
                                             Map<Date,Double> mapToAdd)

getSortedTopMap

public SortedMap<String,Integer> getSortedTopMap(Map<String,Integer> topMap,
                                                 int nbMaxElt)

getSortedTopDoubleMap

public SortedMap<String,Double> getSortedTopDoubleMap(Map<String,Double> topMap,
                                                      int nbMaxElt)

getDeserializedContentTopMap

public static Map<String,ContentTopValue> getDeserializedContentTopMap(Map<String,String> contentTopMap)
Convert a Map of String to map of ContentTopValue

Parameters:
contentTopMap - the Map
Returns:
the converted Map

getSerializedContentTopMap

public static Map<String,String> getSerializedContentTopMap(Map<String,ContentTopValue> contentTopMap)
Convert a Map of ContentTopValue to map of String

Parameters:
contentTopMap - the Map
Returns:
the converted Map

aggregateKeyContentTopMap

public static void aggregateKeyContentTopMap(Map<String,ContentTopValue> origContentTopMap,
                                             Map<String,ContentTopValue> mapToAdd)

getSortedContentTopMap

public static SortedMap<String,ContentTopValue> getSortedContentTopMap(Map<String,ContentTopValue> origContentTopMap,
                                                                       int nbMaxElt)

getActionFromOp

public static String getActionFromOp(int opAction)

isValidOperationAction

public static boolean isValidOperationAction(String opAction)

getUrlSubString

public static String getUrlSubString(String value,
                                     int maxLength)

toJSON

public static String toJSON(Object obj)

removeToDayMetric

public static void removeToDayMetric(Set<AbstractReportMetric> originalSet)
Remove today metric, because this metric is not done.

Parameters:
originalSet - the AbstractReportMetric Set

isBot

public static boolean isBot(EventData data)

getCompatibleWorkspaceSet

public static Set<Workspace> getCompatibleWorkspaceSet()
Get compatible workspaces for analyze (workspace model are ignored) (without any right check)

Returns:
the Set of compatible Workspace

getCompatibleWorkspaceSet

public static Set<Workspace> getCompatibleWorkspaceSet(Member loggedMember)
Get compatible workspaces for analyze (workspace model are ignored)

Parameters:
loggedMember - Member to check rights
Returns:
the Set of compatible Workspace

normalizeMap

public static Map<String,Map<Date,Double>> normalizeMap(Map<String,Map<Date,Double>> dataMap)
Normalize a Map> Map to have value in percentage day by day

Parameters:
dataMap - the map to normalize
Returns:
the new normalized Map

keptBest

public static Map<String,Map<Date,Double>> keptBest(Map<String,Map<Date,Double>> dataMap,
                                                    int nbElement,
                                                    String othersKey)
Compute a new map by top x data and grouping other data.

Parameters:
dataMap - the data map
nbElement - the number of non grouped element
othersKey - the key of grouped element
Returns:
the new map with grouped data


Copyright © 2001-2010 Jalios SA. All Rights Reserved.