/** * Store into the database the login event * @param username the name of the user logged */ public void trackLogin(String username) { Tracker tracker = getTracker(TrackerUtil.LOGIN_TRACKER); if (tracker != null) { ((LoginTracker) tracker).trackLogin(username); } }
/** * Return the rank associated to the templates * @param templateManager the template manager * @return map with key the template name and value the rank associated */ public Map<String, Integer> getRank(TemplateManager templateManager) { TemplateTracker tt = getTemplateTracker(); if (tt != null) { return tt.getRank(templateManager); } return null; }
/** * Store into the database the execution of a query (saved or temporary) * @param type the root type * @param profile the user profile * @param sessionIdentifier the session id */ public void trackQuery(String type, Profile profile, String sessionIdentifier) { Tracker tracker = getTracker(TrackerUtil.QUERY_TRACKER); if (tracker != null) { ((QueryTracker) tracker).trackQuery(type, profile, sessionIdentifier); } }
/** * Store into the database the list execution * @param type the type of the list * @param count the number of items contained * @param profile the user profile * @param sessionIdentifier the session id */ public void trackListExecution(String type, int count, Profile profile, String sessionIdentifier) { Tracker tracker = getTracker(TrackerUtil.LIST_TRACKER); if (tracker != null) { ((ListTracker) tracker).trackList(type, count, null, ListTrackerEvent.EXECUTION, profile, sessionIdentifier); } }
/** * Store into the database the template execution by the user specified in input * @param templateName the template name * @param profile the user profile * @param sessionIdentifier the session id */ public void trackTemplate(String templateName, Profile profile, String sessionIdentifier) { TemplateTracker tt = getTemplateTracker(); if (tt != null) { tt.trackTemplate(templateName, profile, sessionIdentifier); } }
/** * Store into the database the login event * @param keyword the keywords used for the search * @param profile the user profile * @param sessionIdentifier the session id */ public void trackKeywordSearch(String keyword, Profile profile, String sessionIdentifier) { Tracker tracker = getTracker(TrackerUtil.SEARCH_TRACKER); if (tracker != null) { ((KeySearchTracker) tracker).trackSearch(keyword, profile, sessionIdentifier); } }
public void testGetLogarithmMap() throws Exception { MokaTemplateManager templateManager = new MokaTemplateManager(); assertEquals(Math.log(4), templateExecutionsMap.getLogarithmMap("userName1", templateManager).get("template1")); assertNull(templateExecutionsMap.getLogarithmMap("userName1", templateManager).get("template2")); assertEquals(Math.log(2), templateExecutionsMap.getLogarithmMap("userName2", templateManager).get("template1")); assertEquals(Math.log(2), templateExecutionsMap.getLogarithmMap("sessionId1", templateManager).get("template1")); assertEquals(Math.log(4) + Math.log(2) + Math.log(2), templateExecutionsMap.getLogarithmMap(null, templateManager).get("template1")); assertEquals(Math.log(2), templateExecutionsMap.getLogarithmMap(null, templateManager).get("template2")); } }
/** * Called from ShutdownHook. */ public synchronized void shutdown() { close(); }
/** * Test the methd addExecution */ public void testAddExecution() { assertEquals(2, templateExecutionsMap.getTemplateExecutions().size()); Map<String, Integer> templateExecutions = templateExecutionsMap.getTemplateExecutions() .get("template1"); assertEquals(3, templateExecutions.get("userName1").intValue()); assertEquals(1, templateExecutions.get("sessionId1").intValue()); }
/** * Return the rank associated to the templates * @param templateManager the template manager * @return map with key the template name and value the rank associated */ public Map<String, Integer> getRank(TemplateManager templateManager) { TemplateTracker tt = getTemplateTracker(); if (tt != null) { return tt.getRank(templateManager); } return null; }
/** * Store into the database the list execution * @param type the type of the list * @param count the number of items contained * @param profile the user profile * @param sessionIdentifier the session id */ public void trackListExecution(String type, int count, Profile profile, String sessionIdentifier) { Tracker tracker = getTracker(TrackerUtil.LIST_TRACKER); if (tracker != null) { ((ListTracker) tracker).trackList(type, count, null, ListTrackerEvent.EXECUTION, profile, sessionIdentifier); } }
/** * Store into the database the login event * @param username the name of the user logged */ public void trackLogin(String username) { Tracker tracker = getTracker(TrackerUtil.LOGIN_TRACKER); if (tracker != null) { ((LoginTracker) tracker).trackLogin(username); } }
/** * Store into the database the execution of a query (saved or temporary) * @param type the root type * @param profile the user profile * @param sessionIdentifier the session id */ public void trackQuery(String type, Profile profile, String sessionIdentifier) { Tracker tracker = getTracker(TrackerUtil.QUERY_TRACKER); if (tracker != null) { ((QueryTracker) tracker).trackQuery(type, profile, sessionIdentifier); } }
/** * Store into the database the template execution by the user specified in input * @param templateName the template name * @param profile the user profile * @param sessionIdentifier the session id */ public void trackTemplate(String templateName, Profile profile, String sessionIdentifier) { TemplateTracker tt = getTemplateTracker(); if (tt != null) { tt.trackTemplate(templateName, profile, sessionIdentifier); } }
/** * Store into the database the login event * @param keyword the keywords used for the search * @param profile the user profile * @param sessionIdentifier the session id */ public void trackKeywordSearch(String keyword, Profile profile, String sessionIdentifier) { Tracker tracker = getTracker(TrackerUtil.SEARCH_TRACKER); if (tracker != null) { ((KeySearchTracker) tracker).trackSearch(keyword, profile, sessionIdentifier); } }
/** * Called from ShutdownHook. */ public synchronized void shutdown() { close(); }
/** * Return the rank associated to a single template * @param templateManager the template manager * @param templateName the template to get the rank for * @return rank of specified template */ public Integer getRank(TemplateManager templateManager, String templateName) { TemplateTracker tt = getTemplateTracker(); if (tt != null) { return tt.getRank(templateManager, templateName); } return null; }
/** * Store into the database the list creation * @param type the type of the list * @param count the number of items contained * @param buildMode (from identifiers or from the querybuilder page) * @param profile the user profile * @param sessionIdentifier the session id */ public void trackListCreation(String type, int count, ListBuildMode buildMode, Profile profile, String sessionIdentifier) { Tracker tracker = getTracker(TrackerUtil.LIST_TRACKER); if (tracker != null) { ((ListTracker) tracker).trackList(type, count, buildMode, ListTrackerEvent.CREATION, profile, sessionIdentifier); } }
/** * Return the rank associated to a single template * @param templateManager the template manager * @param templateName the template to get the rank for * @return rank of specified template */ public Integer getRank(TemplateManager templateManager, String templateName) { TemplateTracker tt = getTemplateTracker(); if (tt != null) { return tt.getRank(templateManager, templateName); } return null; }
/** * Store into the database the list creation * @param type the type of the list * @param count the number of items contained * @param buildMode (from identifiers or from the querybuilder page) * @param profile the user profile * @param sessionIdentifier the session id */ public void trackListCreation(String type, int count, ListBuildMode buildMode, Profile profile, String sessionIdentifier) { Tracker tracker = getTracker(TrackerUtil.LIST_TRACKER); if (tracker != null) { ((ListTracker) tracker).trackList(type, count, buildMode, ListTrackerEvent.CREATION, profile, sessionIdentifier); } }