public class AuditingUtilities extends Object
Modifier and Type | Method and Description |
---|---|
static DefinitionObject |
createAuditReport(LibrarySession session,
String description,
Long expiration,
Map searchOptions,
AttributeValue[] sortOptions)
Creates an audit report DefinitionObject
as a result of an audit search query.
|
static void |
deleteExpiredAuditFolderPaths(LibrarySession session,
Long expPeriod)
Delete any expired Audit folder paths, that have expired
longer than the specified period.
|
static void |
deleteExpiredGlobalAuditEvents(LibrarySession session,
Folder domain,
AuditSpecification globalSpec)
Delete any expired global audit events that have expired
longer than the specified period.
|
static void |
deleteUnusedAuditFolderPathOverflowEntries(LibrarySession session)
Delete any unused overflow entries for Audit folder paths.
|
static void |
deleteUnusedAuditProperties(LibrarySession session)
Delete any unreferenced Audit event properties.
|
static void |
deleteUnusedAuditTypeLists(LibrarySession session,
Long expirationPeriod)
Delete any unused audit type lists.
|
static String |
generateAuditReportContent(LibrarySession session,
Map searchOptions,
AttributeValue[] sortOptions)
Creates audit report content as a result of an audit search query.
|
static AuditCertificate[] |
getAuditCertificates(LibrarySession session,
long[] objectIdValues)
Select AuditCertificates for the specified object ID values.
|
static AuditTypeEntryValue[] |
getAuditTypesForClass(LibrarySession session,
String className,
int opSucessMode,
boolean includeNested)
Gets the AuditTypeEntryValues for a specified
class name, optionally including any types that are
applicable to a class that is considered a descendent of the
specified class.
|
static AuditTypeEntryValue[] |
getAuditTypesForCreateOperations(LibrarySession session)
Gets the audit operation type values that correspond to "CREATED"
operations.
|
static AuditTypeEntryValue[] |
getAuditTypesForFreeOperations(LibrarySession session)
Gets the audit operation type values that correspond to "FREED"
operations.
|
static Hashtable |
getAuditTypesFromAuditTypeList(LibrarySession session,
Long auditTypeListId)
Gets a resolved view of this AuditTypeList's set of AuditTypeEntries.
|
static AuditTypeEntryValue[] |
getCustomAuditTypes(LibrarySession session)
Gets the custom audit operation type values.
|
static AuditTypeList |
getGlobalAuditTypeList(LibrarySession session)
Gets the AuditTypeList that defines the events saved into the
global audit history.
|
static long |
getHighestAuditId(LibrarySession session)
Returns the highest Audit ID in use or potentially in use.
|
static AttributeValue[] |
listAggregateAuditEventColumnValues(LibrarySession session,
Long specId,
String aggFunction,
String[] colNames,
String[] innerColNames,
String filterClause,
String sortClause)
Returns the list of distinct values of the specified AuditEvent columns,
along with an optional aggregate function.
|
static AttributeValue[] |
listAggregateAuditEventColumnValues(LibrarySession session,
String aggFunction,
String[] columnNames,
Map searchOptions,
AttributeValue[] sortOptions)
Returns the list of distinct values of the specified AuditEvent columns,
along with an optional aggregate function.
|
static void |
performInternalAuditHandlerProcessing(LibrarySession session,
AuditSpecification auditSpec,
boolean eventPosted,
boolean timerExpired)
Initialize and post a notification for a custom
AuditSpecification.
|
static void |
performInternalAuditHandlerProcessing(LibrarySession session,
String specName,
boolean eventPosted,
boolean timerExpired)
Initialize and post a notification for a custom
AuditSpecification.
|
static int |
processRawAuditEvents(LibrarySession session,
int batchSize)
Dispatch events.
|
static AuditEvent[] |
searchAuditHistory(LibrarySession session,
Map searchOptions,
AttributeValue[] sortOptions)
Searches the AuditEvent table given a Map of AuditEvent search options
and a Map of AuditEvent sort options.
|
static void |
setGlobalAuditTypeList(LibrarySession session,
AuditTypeList atl)
Sets the AuditTypeList that defines the events saved into the
global audit history.
|
public static long getHighestAuditId(LibrarySession session) throws IfsException
Used mostly for testing purposes to get the highest auditing ID in use, so that canonical auditing searching can be performed.
The caller will typically use the value returned to subsequently search an audit history using a filter criteria of "ID > [value]", so that the results are limited to the operations performed by that test.
session
- session contextIfsException
- if the operation failspublic static DefinitionObject createAuditReport(LibrarySession session, String description, Long expiration, Map searchOptions, AttributeValue[] sortOptions) throws IfsException
session
- session contextdescription
- description for the audit report DocumentDefinitionexpiration
- expiration time for the audit report
DefinitionObjectsearchOptions
- options to construct the AuditEvent search querysortOptions
- options to specify how to sort the result of
the queryIfsException
- if the operation failspublic static String generateAuditReportContent(LibrarySession session, Map searchOptions, AttributeValue[] sortOptions) throws IfsException
session
- session contextsearchOptions
- options to construct the AuditEvent search querysortOptions
- options to specify how to sort the result of the
queryIfsException
- if the operation failspublic static AuditEvent[] searchAuditHistory(LibrarySession session, Map searchOptions, AttributeValue[] sortOptions) throws IfsException
session
- session contextsearchOptions
- options to construct the AuditEvent search querysortOptions
- options to specify how to sort the result of
the queryIfsException
- if the operation failspublic static AttributeValue[] listAggregateAuditEventColumnValues(LibrarySession session, String aggFunction, String[] columnNames, Map searchOptions, AttributeValue[] sortOptions) throws IfsException
session
- session contextaggFunction
- the aggregate function; can be null.columnNames
- AuditEvent columns for which to list distinct valuessearchOptions
- options to construct the AuditEvent search querysortOptions
- options to specify how to sort the result of
the queryIfsException
- if the operation failspublic static AttributeValue[] listAggregateAuditEventColumnValues(LibrarySession session, Long specId, String aggFunction, String[] colNames, String[] innerColNames, String filterClause, String sortClause) throws IfsException
session
- session contextspecId
- the AuditSpecification IDaggFunction
- the aggregate function; can be null.colNames
- AuditEvent columns for which to list distinct valuesinnerColNames
- the audit table column names to use in the
inner select; if null, no inner select is usedfilterClause
- the filter criteria (where clause)sortClause
- the sort criteria (order by clause)IfsException
- if the operation failspublic static int processRawAuditEvents(LibrarySession session, int batchSize) throws IfsException
Constructs a new dispatcher and delegates to it.
session
- session contextbatchSize
- number of events to process in a single batchIfsException
- if the operation failspublic static void performInternalAuditHandlerProcessing(LibrarySession session, String specName, boolean eventPosted, boolean timerExpired) throws IfsException
Notification can be for either a "event posted", "timer expired", or both. This mimics what the EventHandlerAgent does for processing a custom AuditSpecification. Only works for INTERNAL handlers; takes no action if the specified AuditSpecification does not reference an internal handler.
session
- the session contextspecName
- the name of the AuditSpecificationeventPosted
- whether to perform "event posted" processingtimerExpired
- whether to perform "timer expired" processingIfsException
- if the operation failspublic static void performInternalAuditHandlerProcessing(LibrarySession session, AuditSpecification auditSpec, boolean eventPosted, boolean timerExpired) throws IfsException
Notification can be for either a "event posted", "timer expired", or both. This mimics what the EventHandlerAgent does for processing a custom AuditSpecification. Only works for INTERNAL handlers; takes no action if the specified AuditSpecification does not reference an internal handler.
session
- the session contextauditSpec
- the AuditSpecificationeventPosted
- whether to perform "event posted" processingtimerExpired
- whether to perform "timer expired" processingIfsException
- if the operation failspublic static AuditTypeEntryValue[] getAuditTypesForClass(LibrarySession session, String className, int opSucessMode, boolean includeNested) throws IfsException
The AuditTypeEntryValues returned are all constructed with the same operation success mode that is specified.
session
- the session contextclassName
- the class name of interest, force to upper case
(e.g. FOLDER)opSucessMode
- the success mode to use for each AuditTypeEntryValueincludeNested
- whether or not to include operations for classes
that are descendents of the specified classIfsException
- if the operation failspublic static AuditTypeEntryValue[] getAuditTypesForCreateOperations(LibrarySession session) throws IfsException
Used to indicate when an object has been created simply by inspecting event types.
session
- the session contextIfsException
- if the operation failspublic static AuditTypeEntryValue[] getAuditTypesForFreeOperations(LibrarySession session) throws IfsException
Used to indicate when an object has been freed simply by inspecting event types.
session
- the session contextIfsException
- if the operation failspublic static AuditTypeEntryValue[] getCustomAuditTypes(LibrarySession session) throws IfsException
session
- the session contextIfsException
- if the operation failspublic static AuditCertificate[] getAuditCertificates(LibrarySession session, long[] objectIdValues) throws IfsException
session
- session contextobjectIdValues
- object ID valuesIfsException
- if the operation failspublic static Hashtable getAuditTypesFromAuditTypeList(LibrarySession session, Long auditTypeListId) throws IfsException
The Hashtable returned is keyed by operation type (the Integer), and has a value of an AuditTypeEntryValue.
session
- library sessionauditTypeListId
- id of the audit type listIfsException
- if operation fails.public static void deleteUnusedAuditProperties(LibrarySession session) throws IfsException
Performed as a periodic cleanup task.
session
- session contextIfsException
- if the operation failspublic static void deleteUnusedAuditTypeLists(LibrarySession session, Long expirationPeriod) throws IfsException
Performed as a clenup task.
session
- session contextexpirationPeriod
- expiration period for AuditTypeListsIfsException
- if the operation failspublic static void deleteExpiredAuditFolderPaths(LibrarySession session, Long expPeriod) throws IfsException
Performed as a periodic cleanup task.
session
- session contextexpPeriod
- the minimum amount of time, in milliseconds, that
the AuditFolderPaths have to be expired in order
to be deletedIfsException
- if the operation failspublic static void deleteExpiredGlobalAuditEvents(LibrarySession session, Folder domain, AuditSpecification globalSpec) throws IfsException
Performed as a periodic cleanup task.
session
- session contextdomain
- audit domain on which we need to actglobalSpec
- OOB Global audit specification;
if null, this method fetches itIfsException
- if the operation failspublic static void deleteUnusedAuditFolderPathOverflowEntries(LibrarySession session) throws IfsException
Performed as a periodic cleanup task.
session
- session contextIfsException
- if the operation failspublic static AuditTypeList getGlobalAuditTypeList(LibrarySession session) throws IfsException
session
- session context (must not be null)IfsException
- if the operation failspublic static void setGlobalAuditTypeList(LibrarySession session, AuditTypeList atl) throws IfsException
session
- session context (must not be null)atl
- the global AuditTypeListIfsException
- if the operation failsCopyright © 2023. All rights reserved.