Class StatDB

java.lang.Object
sk.iway.iwcm.DB
sk.iway.iwcm.stat.StatDB

public class StatDB extends DB
Description of the Class
  • Field Details

  • Method Details

    • getInstance

      public static StatDB getInstance()
    • getInstance

      public static StatDB getInstance(boolean force_refresh)
      Gets the instance attribute of the StatDB class
    • getSetValue

      public int getSetValue(String value)
    • getValue

      public String getValue(int id)
    • getStatKeyId

      public static int getStatKeyId(String value)
      Vrati stat_key (cache) ID pre zadany vyraz
    • getStatKeyValue

      public static String getStatKeyValue(int id)
      Vrati stat_key (cache) value pre zadane id
    • getYearTimeSQL

      public static String getYearTimeSQL(Date from, Date to, boolean where)
      Gets the yearTimeSQL attribute of the StatDB object
    • getRootGroupWhere

      public static String getRootGroupWhere(String column, int rootGroupId)
      Spravi obmedzenie na documents.groups tak, aby boli len v podadresaroch rootGroupId
    • getRootGroupWhere

      public static String getRootGroupWhere(String column, String groupIds)
      Spravi obmedzenie na documents.groups tak, aby boli len v podadresaroch groupsId
    • addAdmin

      public static void addAdmin(jakarta.servlet.http.HttpServletRequest request)
    • add

      public static void add(jakarta.servlet.http.HttpSession session, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, int docId)
      prida zaznam do statistiky
    • addError

      public static void addError(String url, String queryString)
      Zapise chybu do databazy
    • addError

      public static void addError(String url, String queryString, jakarta.servlet.http.HttpServletRequest request)
    • removeJsessionId

      protected static String removeJsessionId(String url)
      Removes JSESSIONID from URL
      Parameters:
      url -
      Returns:
    • getLanguageDomainTable

      public static Map<String,String> getLanguageDomainTable()
      Ziska tabulku mapovania jazyka na domenu
      Returns:
    • setLanguageDomainTable

      public static void setLanguageDomainTable(Map<String,String> newLanguageDomainTable)
      Nastavenie (vymazanie) tabulky mapovania jazykov a domen
      Parameters:
      newLanguageDomainTable -
    • addStatSearchLocal

      public static void addStatSearchLocal(String searchTerm, int docId, jakarta.servlet.http.HttpServletRequest request)
      Zapise statistiku vyhladavania priamo na web stranke (do statistiky Vyhladavace), ako Nazov vyhladavaca bude uvedene WebJET
      Parameters:
      searchTerm - - vyhladavany vyraz
      docId - - docId stranky s vysledkami vyhladavania
      request - - request (ziska sa z neho remote IP)
    • getBrowserId

      public static long getBrowserId(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response)
      Funkcia, ktora vrati ciselny identifikator pouzivatela, zapisuje sa do databazy na rozlisenie roznych pouzivatelov
      Ak je to prihlaseny pouzivatel, vrati jeho (userId + konstanta Constants.getInt("loggedUserBrowserId"))
      Ak je to vyhladavaci stroj, vrati sa jeho Id z tabulky seo_bots
      Ak je to neprihlaseny pouzivatel, vrati sa mu (vygenerovane cislo + Constants.getInt("unloggedUserBrowserId"))
      Ak je to pouzivatel, ktory ma uz vygenerovane browserId a zapisane v cookies, tak sa vrati to

      Ak nema zapisane v cookies a je to neprihlaseny pouzivatel, tak sa mu vygenerovane browserId zapise do cookies, takisto sa vygenerovane browserId zapise aj do session pod atributom "statFromBrowserId"
      Parameters:
      request -
      response -
      Returns:
      cislo typu long identifikujuce pouzivatela
    • getBrowserId

      public static long getBrowserId(jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, BrowserDetector browser)
      Funkcia, ktora vrati ciselny identifikator pouzivatela, zapisuje sa do databazy na rozlisenie roznych pouzivatelov
      Ak je to prihlaseny pouzivatel, vrati jeho (userId + konstanta Constants.getInt("loggedUserBrowserId"))
      Ak je to vyhladavaci stroj, vrati sa jeho Id z tabulky seo_bots
      Ak je to neprihlaseny pouzivatel, vrati sa mu (vygenerovane cislo + Constants.getInt("unloggedUserBrowserId"))
      Ak je to pouzivatel, ktory ma uz vygenerovane browserId a zapisane v cookies, tak sa vrati to

      Ak nema zapisane v cookies a je to neprihlaseny pouzivatel, tak sa mu vygenerovane browserId zapise do cookies, takisto sa vygenerovane browserId zapise aj do session pod atributom "statFromBrowserId"
      Parameters:
      request -
      response -
      Returns:
      cislo typu long identifikujuce pouzivatela
    • getSessionId

      public static long getSessionId(jakarta.servlet.http.HttpServletRequest request)
    • addStatFrom

      public static void addStatFrom(jakarta.servlet.http.HttpSession session, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, BrowserDetector browser, int docId, int groupId)
      Prida do DB zaznam o adrese z ktorej prisiel user na stranku, browserId a sessionId
    • addStatViews

      public static void addStatViews(jakarta.servlet.http.HttpSession session, jakarta.servlet.http.HttpServletRequest request, jakarta.servlet.http.HttpServletResponse response, int docId, int lastDocId, BrowserDetector browser)
      Zapis statistiky do stat_views
    • getTokens

      public static String[] getTokens(String groups, String delimiter)
      Vrati pole typu String, s jednotlivymi polozkami v retazci, ak sa retazec neda rozdelit, vrati prazdne pole
      Parameters:
      groups - - retazec, ktory sa ma rozparsovat
      delimiter -
      Returns:
    • sortByValue

      public static <K, V extends Number> Map<K,V> sortByValue(Map<K,V> map)
      Metoda vrati mapu usporiadanu podla hodnot (values) od najvacsieho po najmensie
    • sortByKey

      public static <K extends Comparable<K>, V> Map<K,V> sortByKey(Map<K,V> map)
      Metoda vrati mapu usporiadanu podla klucov (key) od A po Z
    • getSearchCloudTags

      public static Collection<Column> getSearchCloudTags(int maxTags, int daysFrom, String searchUrlBase) throws IllegalArgumentException
      Gets max x tags for opencloud from daysFrom ago till now
      Parameters:
      maxTags - max tags returned
      daysFrom - number of days from now to past
      searchUrlBase - base url for search (i.e.: "/showdoc.do?docid=36&words=")
      Returns:
      collection of max maxTags tags from daysFrom days till now
      Throws:
      IllegalArgumentException - when maxTags or daysFrom are negative or zero, or searchUrlBase is null