@ThreadSafe public class SimpleAuditManager extends AbstractWALDAO<AuditItem> implements IAuditor
IDAO.EModeDEFAULT_WAITING_TIME, WAL_XWS, WRITE_XWSDEFAULT_AUTO_SAVE_ENABLED, m_aRWLock| Constructor and Description |
|---|
SimpleAuditManager(String sFilename,
ICurrentUserIDProvider aCurrentUserIDProvider)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
void |
createAuditItem(EAuditActionType eActionType,
com.helger.commons.state.ESuccess eSuccess,
String sAction,
Object... aArgs)
Create a new audit item.
|
protected com.helger.xml.microdom.IMicroDocument |
createWriteData()
Create the XML document that should be saved to the file.
|
boolean |
equals(Object o) |
List<IAuditItem> |
getAllAuditItems() |
int |
getAuditItemCount() |
List<IAuditItem> |
getLastAuditItems(int nMaxItems) |
int |
hashCode() |
protected com.helger.commons.state.EChange |
onRead(com.helger.xml.microdom.IMicroDocument aDoc)
Fill the internal structures with from the passed XML document.
|
protected void |
onRecoveryCreate(AuditItem aItem)
Called when a recovery is needed to create a new item.
|
protected void |
onRecoveryDelete(AuditItem aElement)
Called when a recovery is needed to delete an existing item.
|
protected void |
onRecoveryUpdate(AuditItem aElement)
Called when a recovery is needed to update an existing item.
|
String |
toString() |
convertNativeToWALString, convertWALStringToNative, getDAOIO, getDataTypeClass, getFilenameProvider, getInitCount, getLastFilename, getLastInitDateTime, getLastReadDateTime, getLastWriteDateTime, getReadCount, getSafeFile, getWaitingTime, getWALXMLWriterSettings, getWriteCount, getXMLWriterSettings, initialRead, markAsChanged, markAsChanged, modifyWriteData, onBetweenReadAndWAL, onFilenameChange, onInit, setWaitingTime, triggerExceptionHandlersRead, triggerExceptionHandlersWrite, writeToFileOnPendingChangesbeginWithoutAutoSave, endWithoutAutoSave, getExceptionHandlersRead, getExceptionHandlersWrite, hasPendingChanges, internalHasPendingChanges, internalIsAutoSaveEnabled, internalSetPendingChanges, isAutoSaveEnabled, isDebugLogging, performWithoutAutoSave, performWithoutAutoSave, performWithoutAutoSaveThrowing, performWithoutAutoSaveThrowingclone, finalize, getClass, notify, notifyAll, wait, wait, waitonCreateFailure, onCreateSuccess, onDeleteFailure, onDeleteSuccess, onExecuteFailure, onExecuteFailure, onExecuteSuccess, onExecuteSuccess, onModifyFailure, onModifySuccess, onUndeleteFailure, onUndeleteSuccesspublic SimpleAuditManager(@Nullable String sFilename, @Nonnull ICurrentUserIDProvider aCurrentUserIDProvider) throws DAOException
sFilename - The filename to write the audits to. May be null to
indicate an in-memory auditor only.aCurrentUserIDProvider - The current user ID provider. May not be null.DAOException - In case reading failed@IsLocked(value=WRITE) protected void onRecoveryCreate(@Nonnull AuditItem aItem)
AbstractWALDAOonRecoveryCreate in class AbstractWALDAO<AuditItem>aItem - The element to be created. Never null.@IsLocked(value=WRITE) protected void onRecoveryUpdate(@Nonnull AuditItem aElement)
AbstractWALDAOonRecoveryUpdate in class AbstractWALDAO<AuditItem>aElement - The element to be updated. Never null.@IsLocked(value=WRITE) protected void onRecoveryDelete(@Nonnull AuditItem aElement)
AbstractWALDAOonRecoveryDelete in class AbstractWALDAO<AuditItem>aElement - The element to be deleted. Never null.@Nonnull protected com.helger.commons.state.EChange onRead(@Nonnull com.helger.xml.microdom.IMicroDocument aDoc)
AbstractWALDAOonRead in class AbstractWALDAO<AuditItem>aDoc - The XML document to read from. Never null.EChange.CHANGED if reading the data changed something in
the internal structures that requires a writing.protected com.helger.xml.microdom.IMicroDocument createWriteData()
AbstractWALDAOcreateWriteData in class AbstractWALDAO<AuditItem>null document to write to the file.public void createAuditItem(@Nonnull EAuditActionType eActionType, @Nonnull com.helger.commons.state.ESuccess eSuccess, @Nonnull String sAction, @Nullable Object... aArgs)
IAuditorcreateAuditItem in interface IAuditoreActionType - Action type. May not be null.eSuccess - Success or failure? May not be null.sAction - The performed action. May not be null.aArgs - An optional array of arguments. May be null or empty.@Nonnegative public int getAuditItemCount()
@Nonnull @ReturnsMutableCopy public List<IAuditItem> getAllAuditItems()
@Nonnull @ReturnsMutableCopy public List<IAuditItem> getLastAuditItems(@Nonnegative int nMaxItems)
public String toString()
toString in class AbstractWALDAO<AuditItem>Copyright © 2014–2017 Philip Helger. All rights reserved.