lumis.portal.audit
Class AuditManager

Package class diagram package AuditManager
java.lang.Object
  extended by lumis.portal.audit.AuditManager
All Implemented Interfaces:
IAuditManager

public class AuditManager
extends Object
implements IAuditManager

Manager for Auditing.

Since:
6.0.0

Nested Class Summary
static class AuditManager.AuditType
          Enum of audit types used by audit actions taken.
 
Field Summary
 
Fields inherited from interface lumis.portal.audit.IAuditManager
QUERY_CACHE_REGION
 
Constructor Summary
AuditManager()
           
 
Method Summary
 void audit(String title, String description, String typeKey)
          Register an audit entry.
 lumis.portal.audit.AuditEntry audit(String title, String description, String typeKey, boolean registerChilds, ITransaction t)
          Starts an operation for audit and add register an observer to the transaction in order to end the operation.
 lumis.portal.audit.AuditEntry beginAudit(String title, String description, String typeKey, boolean registerChilds)
          Starts an operation for audit.
 void clearContextThreadData()
          Clears the AuditContext thread data.
 void disableType(String auditEntryTypeId)
          Disable the AuditEntryType by it's id.
 void enableType(String auditEntryTypeId)
          Enable the AuditEntryType by it's id.
 void endAudit(lumis.portal.audit.AuditEntry auditEntry)
          Ends the AuditEntry operation.
protected  void endContext(lumis.portal.audit.AuditEntry auditEntry)
          End the audit context.
protected  AuditCategory findCategoryById(String categoryId)
          Find the category by it's id.
protected  AuditCategory findCategoryByKey(String categoryKey)
          Find the AuditCategory by it's key.
protected  AuditEntryType findEntryTypeByKey(String entryTypeKey)
          Find the AuditEntryType by it's key.
protected  void initContext(lumis.portal.audit.AuditEntry auditEntry, boolean registerChilds)
          Initializes the audit context.
protected  lumis.portal.audit.AuditEntry initEntry(String userId, String userLogin, String title, String description, AuditEntryType type, boolean registerChilds)
          Creates an instance of AuditEntry.
protected  void logEntry(lumis.portal.audit.AuditEntry auditEntry)
          Log the audit entry.
 AuditConfig obtainConfiguration()
          Obtain the audit configuration.
protected  void registerEntry(lumis.portal.audit.AuditEntry auditEntry, AuditEntryState state)
          Register the audit entry in database.
 void removeOldEntries()
          Remove audit entries older than the number of days specified by the cleanInterval field in configuration.
 void updateCleanInterval(int cleanInterval)
          Updates the time interval to clean audit entries.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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

enableType

public void enableType(String auditEntryTypeId)
                throws PortalException
Enable the AuditEntryType by it's id.

Parameters:
auditEntryTypeId - the type id.
Throws:
AccessDeniedException - if the user has not permission to use management functions.
PortalException
Since:
6.0.0

disableType

public void disableType(String auditEntryTypeId)
                 throws PortalException
Disable the AuditEntryType by it's id.

Parameters:
auditEntryTypeId - the type id.
Throws:
AccessDeniedException - if the user has not permission to use management functions.
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

obtainConfiguration

public AuditConfig obtainConfiguration()
                                throws PortalException
Obtain the audit configuration.

Returns:
an instance of AuditConfig.
Throws:
PortalException - if an error occur retrieving the configuration.
Since:
6.0.0

clearContextThreadData

public void clearContextThreadData()
Clears the AuditContext thread data.

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


Lumisportal  6.2.0.120405 - Copyright © 2006–2012 Lumis EIP Tecnologia da Informação LTDA. All Rights Reserved.