Package com.avoka.fc.core.dao
Class AuditLogDao
- java.lang.Object
-
- com.avoka.core.dao.BaseDao
-
- com.avoka.fc.core.dao.AbstractDao
-
- com.avoka.fc.core.dao.AuditLogDao
-
public class AuditLogDao extends AbstractDao
Provides a DAO for the AuditLog entity.- See Also:
AuditLog
-
-
Field Summary
-
Fields inherited from class com.avoka.core.dao.BaseDao
FETCH_LIMIT, STATEMENT_MAX_NO_PARAMETERS
-
-
Constructor Summary
Constructors Constructor Description AuditLogDao()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description AuditLog
createAuditLogRecord(BaseEntity entity, String message, String type)
Create an audit log recordAuditLog
createAuditLogRecord(BaseEntity entity, String message, String type, Submission submission)
Create an audit log recordList<AuditLog>
getAuditLogList(String clientId, String changedBy, String operation, String message, String entityName, String entityId, Date startDate, Date endDate, int pageSize, int fetchLimit)
Return a list of audit log records matching the search criteriaList<AuditLog>
getAuditLogList(String clientId, String changedBy, String message, String entityName, String entityId, Date startDate, Date endDate, String sortBy, boolean ascending, int pageSize)
Return a list of audit log records matching the search criteriaList<AuditLog>
getAuditLogList(String clientId, String changedBy, String message, String entityName, String entityId, Date startDate, Date endDate, String sortBy, boolean ascending, int pageSize, int fetchLimit)
Return a list of audit log records matching the search criteriavoid
iterateOverFullAuditLog(org.apache.cayenne.ResultIteratorCallback<AuditLog> op)
Iterates over the FULL audit log, sorted ascending by audit datetime, applying provided callback.int
purgeAuditLog(int maxAgeDays, int fetchLimit, long maxTimeMs)
Purge audit log records older than a specified number of days-
Methods inherited from class com.avoka.fc.core.dao.AbstractDao
andFilterClientExcludeNull, andFilterClientIncludeNull, andFilterClientOnly, isClientAccessAllowed, performQueryConfigCached
-
Methods inherited from class com.avoka.core.dao.BaseDao
addOrdering, addOrderingCaseInsensitive, addOrderingCaseSensitive, andQueryBetween, andQueryInExp, andQueryInExp, andQueryLikeIgnoreCaseExp, andQueryMatchDbExp, andQueryMatchExp, andQueryMatchIsNotNull, andQueryMatchIsNull, andQueryNoMatchExp, andQueryNotTrue, deleteObject, deleteObjects, findObject, getDataContext, getFetchLimit, getLogger, getObjectForPK, newObject, orQueryLikeIgnoreCaseExp, orQueryMatchExp, performNamedQuery, performNamedQuery, performNamedQuery, performNamedQuery, performNonSelectingQuery, performNonSelectingQuery, performNonSelectingQuery, performNonSelectingQuery, performQuery, performQuery, performQuery, registerNewObject, setCacheStrategy, setFetchLimit, setLocalCacheStrategy, setLocalCacheStrategy, setSharedCacheStrategy, toMap, toMap
-
-
-
-
Method Detail
-
createAuditLogRecord
public AuditLog createAuditLogRecord(BaseEntity entity, String message, String type, Submission submission)
Create an audit log record- Parameters:
entity
- the non-null entity that was accessedmessage
- the non-empty audit messagetype
- a valid audit type (AuditLog.EVENT_TYPE_VIEW
,AuditLog.EVENT_TYPE_CREATE
,AuditLog.EVENT_TYPE_UPDATE
orAuditLog.EVENT_TYPE_DELETE
)submission
- the associated submission- Returns:
- the audit log record
-
createAuditLogRecord
public AuditLog createAuditLogRecord(BaseEntity entity, String message, String type)
Create an audit log record- Parameters:
entity
- the non-null entity that was accessedmessage
- the non-empty audit messagetype
- a valid audit type (AuditLog.EVENT_TYPE_VIEW
,AuditLog.EVENT_TYPE_CREATE
,AuditLog.EVENT_TYPE_UPDATE
orAuditLog.EVENT_TYPE_DELETE
)- Returns:
- the audit log record
-
getAuditLogList
public List<AuditLog> getAuditLogList(String clientId, String changedBy, String message, String entityName, String entityId, Date startDate, Date endDate, String sortBy, boolean ascending, int pageSize)
Return a list of audit log records matching the search criteria- Parameters:
clientId
- the client OID (optional)changedBy
- a substring of the "Changed By" attribute (optional)message
- a substring of the audit message (optional)entityName
- the name of the audited entity, e.g. "Form" (optional)entityId
- the entity OID (optional)startDate
- the lower bound of the date range to search (optional)endDate
- the upper bound of the date range to search (optional)sortBy
- the column to sort by (optional)ascending
- whether to sort ascendingpageSize
- the page size to be used in the query- Returns:
- the list of matching audit log records
-
getAuditLogList
public List<AuditLog> getAuditLogList(String clientId, String changedBy, String message, String entityName, String entityId, Date startDate, Date endDate, String sortBy, boolean ascending, int pageSize, int fetchLimit)
Return a list of audit log records matching the search criteria- Parameters:
clientId
- the client OID (optional)changedBy
- a substring of the "Changed By" attribute (optional)message
- a substring of the audit message (optional)entityName
- the name of the audited entity, e.g. "Form" (optional)entityId
- the entity OID (optional)startDate
- the lower bound of the date range to search (optional)endDate
- the upper bound of the date range to search (optional)sortBy
- the column to sort by (optional)ascending
- whether to sort ascendingpageSize
- the page size to be used in the queryfetchLimit
- the query fetch limit- Returns:
- the list of matching audit log records
- Since:
- 4.3.0
-
getAuditLogList
public List<AuditLog> getAuditLogList(String clientId, String changedBy, String operation, String message, String entityName, String entityId, Date startDate, Date endDate, int pageSize, int fetchLimit)
Return a list of audit log records matching the search criteria- Parameters:
clientId
- the client OID (optional)changedBy
- a substring of the "Changed By" attribute (optional)operation
- type of Operation to filter by (optional) @since 17.10.2message
- a substring of the audit message (optional)entityName
- the name of the audited entity, e.g. "Form" (optional)entityId
- the entity OID (optional)startDate
- the lower bound of the date range to search (optional)endDate
- the upper bound of the date range to search (optional)pageSize
- the page size to be used in the queryfetchLimit
- the query fetch limit- Returns:
- the list of matching audit log records
- Since:
- 4.3.3
-
purgeAuditLog
public int purgeAuditLog(int maxAgeDays, int fetchLimit, long maxTimeMs)
Purge audit log records older than a specified number of days- Parameters:
maxAgeDays
- The age in days above which records will be deleted. If this value is negative or equal to 0, no records will be purged.fetchLimit
- the maximum number of records to delete (only used if > 0)maxTimeMs
- the maximum time that can be used to purge records- Returns:
- the number of records that were deleted
-
iterateOverFullAuditLog
public void iterateOverFullAuditLog(org.apache.cayenne.ResultIteratorCallback<AuditLog> op)
Iterates over the FULL audit log, sorted ascending by audit datetime, applying provided callback.- Parameters:
op
- an operation to be invoked on each object during iteration.- Since:
- 19.05.0
-
-