Class AuditManager

  • All Implemented Interfaces:
    IAuditManager

    public class AuditManager
    extends Object
    implements IAuditManager
    Manager for Auditing.
    Since:
    6.0.0
    Version:
    $Revision: 24985 $ $Date: 2022-05-02 23:04:30 -0300 (Mon, 02 May 2022) $
    • Constructor Detail

      • AuditManager

        public AuditManager()
    • Method Detail

      • audit

        public void audit​(String title,
                          String description,
                          String typeKey)
                   throws PortalException
        Register an audit entry.
        Specified by:
        audit in interface IAuditManager
        Parameters:
        title - the operation title. If the title is bigger than the allowed size, the string is truncated.
        description - the operation description.
        typeKey - the AuditEntryType key.
        Throws:
        PortalException
        Since:
        6.0.0
      • audit

        public lumis.portal.audit.AuditEntry audit​(String title,
                                                   String description,
                                                   String typeKey,
                                                   boolean registerChilds,
                                                   ITransaction t)
                                            throws PortalException
        Starts an operation for audit and add register an observer to the transaction in order to end the operation. The entry is registered in database as initialized.
        Parameters:
        title - the operation title.
        description - the operation description.
        categoryKey - the AuditCategory key.
        typeKey - the AuditEntryType key.
        registerChilds - true if the child entries must be saved in database, false otherwise.
        Returns:
        an instance of AuditEntry representing the operation.
        Throws:
        PortalException
        Since:
        6.0.0
      • beginAudit

        public lumis.portal.audit.AuditEntry beginAudit​(String title,
                                                        String description,
                                                        String typeKey,
                                                        boolean registerChilds)
                                                 throws PortalException
        Starts an operation for audit. The entry is registered in database as initialized.
        Parameters:
        title - the operation title.
        description - the operation description.
        categoryKey - the AuditCategory key.
        typeKey - the AuditEntryType key.
        registerChilds - true if the child entries must be saved in database, false otherwise.
        Returns:
        an instance of AuditEntry representing the operation.
        Throws:
        PortalException
        Since:
        6.0.0
      • endAudit

        public void endAudit​(lumis.portal.audit.AuditEntry auditEntry)
                      throws PortalException
        Ends the AuditEntry operation.
        Parameters:
        auditEntry - the AuditEntry instance.
        Throws:
        PortalException
        Since:
        6.0.0
      • removeOldEntries

        public void removeOldEntries()
                              throws PortalException
        Remove audit entries older than the number of days specified by the cleanInterval field in configuration.
        Throws:
        PortalException
        Since:
        6.0.0
      • updateCleanInterval

        public void updateCleanInterval​(int cleanInterval)
                                 throws PortalException
        Updates the time interval to clean audit entries.
        Parameters:
        cleanInterval - the new value for time interval in days.
        Throws:
        AccessDeniedException - if the user has not permission to use management functions.
        PortalException - if an error occur updating the time interval.
        Since:
        6.0.0
      • clearContextThreadData

        public boolean clearContextThreadData()
        Clears the AuditContext thread data.
        Returns:
        true if there was data to be cleared or false if the thread data was already clear.
        Since:
        6.0.0
      • initEntry

        protected lumis.portal.audit.AuditEntry initEntry​(String userId,
                                                          String userLogin,
                                                          String title,
                                                          String description,
                                                          AuditEntryType type,
                                                          boolean registerChilds)
        Creates an instance of AuditEntry.
        Parameters:
        user - user.
        title - a title for the operation being audited. If the title is bigger than the allowed, a substring is created.
        description - a description for the operation.
        type - the AuditEntryType instance.
        registerChilds - true if the child entries must be saved in database, false otherwise.
        Returns:
        an instance of AuditEntry.
        Since:
        6.0.0
      • findCategoryByKey

        protected AuditCategory findCategoryByKey​(String categoryKey)
                                           throws PortalException
        Find the AuditCategory by it's key.
        Parameters:
        categoryKey - the audit category key.
        Returns:
        the instance of AuditCategory.
        Throws:
        PortalException - if an error occur in audit category dao.
        Since:
        6.0.0
      • findCategoryById

        protected AuditCategory findCategoryById​(String categoryId)
                                          throws PortalException
        Find the category by it's id.
        Parameters:
        categoryId - the category id.
        Returns:
        the AuditCategory instance.
        Throws:
        PortalException
        Since:
        6.0.0
      • findEntryTypeByKey

        protected AuditEntryType findEntryTypeByKey​(String entryTypeKey)
                                             throws PortalException
        Find the AuditEntryType by it's key.
        Parameters:
        entryTypeKey - the audit entry type key.
        Returns:
        the instance of AuditEntryType.
        Throws:
        PortalException - if an error occur in audit entry type dao.
        Since:
        6.0.0
      • initContext

        protected void initContext​(lumis.portal.audit.AuditEntry auditEntry,
                                   boolean registerChilds)
        Initializes the audit context.
        Parameters:
        auditEntry - the AuditEntry instance.
        registerChilds - true if the child entries must be saved in database, false otherwise.
        Since:
        6.0.0
      • endContext

        protected void endContext​(lumis.portal.audit.AuditEntry auditEntry)
        End the audit context.
        Parameters:
        auditEntry - the AuditEntry instance.
        Since:
        6.0.0
      • logEntry

        protected void logEntry​(lumis.portal.audit.AuditEntry auditEntry)
        Log the audit entry.
        Parameters:
        auditEntry - the AuditEntry instance.
        Since:
        6.0.0
      • registerEntry

        protected void registerEntry​(lumis.portal.audit.AuditEntry auditEntry,
                                     AuditEntryState state)
                              throws PortalException
        Register the audit entry in database.
        Parameters:
        auditEntry - the AuditEntry instance.
        state - the state of audit entry.
        Throws:
        PortalException
        Since:
        6.0.0