Class SessionInfo

  • public class SessionInfo
    extends Object
    This class is used to maintain session information which will be used for audit purposes.
    • Constructor Detail

      • SessionInfo

        public SessionInfo()
    • Method Detail

      • init

        public static void init()
        Sets all session information to null. Called at the end of http-request handling, to reset the audit information for that thread.
      • initDB

        public static void initDB​(Connection conn,
                                  String rdbms)
        Creates the needed infrastructure for audit. Which is temporary session table for PostgreSQL connections. Called whenever a new physical db-connection is created.
        conn - Connection to database
        rdbms - Database, only action is take for POSTGRESQL
      • saveContextInfoIntoDB

        public static void saveContextInfoIntoDB​(Connection conn)
        Saves currently stored context information into DB. Generally, this method shouldn't be directly invoked, as the Platform already does it when flushing changes to DB. Only in case Openbravo platform is bypassed (ie. DB operations performed on a manually obtained connection), this method must be manually invoked.
        conn - The connection where the session information will be stored in, note it must be the same one performing DB modifications so audit trail triggers can retrieve the session information.
      • setDBSessionInfo

        public static void setDBSessionInfo​(Connection conn,
                                            String rdbms)
        Initialized DB with temporary table and sets session information on it.
        conn - Connection where the session information will be stored in
        rdbms - Database type
      • setUserId

        public static void setUserId​(String user)
      • getUserId

        public static String getUserId()
      • setProcessId

        public static void setProcessId​(String processId)
      • getProcessId

        public static String getProcessId()
      • setProcessType

        public static void setProcessType​(String processType)
      • getProcessType

        public static String getProcessType()
      • setSessionId

        public static void setSessionId​(String session)
      • infoChanged

        public static void infoChanged()
        Forces changed info flag so next time it is checked it session info will be set in DB
      • getCommand

        public static String getCommand()
      • setCommand

        public static void setCommand​(String comm)
      • getQueryProfile

        public static String getQueryProfile()
      • setQueryProfile

        public static void setQueryProfile​(String profile)
      • getAdditionalInfo

        public static Object getAdditionalInfo​(String property)
        Retrieves the value of an additional session info property which has been previously saved with setAddionalInfo(String, Object).
        property - The name of the additional session info property
        the value stored for the given property or null in case a value can not be found
      • setAddionalInfo

        public static void setAddionalInfo​(String property,
                                           Object value)
        Sets the value of an additional session info property.
        property - The name of the additional session info property
        value - The value to be assigned to the property
      • getSessionId

        public static String getSessionId()
      • setAuditActive

        public static void setAuditActive​(boolean isAuditActive)
      • isInitialized

        public static boolean isInitialized()
      • getModuleId

        public static String getModuleId()
      • setModuleId

        public static void setModuleId​(String moduleId)
      • isUsageAuditActive

        public static boolean isUsageAuditActive()
      • setUsageAuditActive

        public static void setUsageAuditActive​(boolean usageAuditActive)
      • auditThisThread

        public static void auditThisThread​(boolean shouldAudit)
        Set this value to false to prevent context info to be set in DB