Class AbstractAuditDAOImpl

  • All Implemented Interfaces:
    AuditDAO
    Direct Known Subclasses:
    AuditDAOImpl

    public abstract class AbstractAuditDAOImpl
    extends java.lang.Object
    implements AuditDAO
    Abstract helper DAO for alf_audit_XXX tables.
    Since:
    3.2
    Author:
    Derek Hulley
    • Field Detail

      • logger

        protected final org.apache.commons.logging.Log logger
    • Constructor Detail

      • AbstractAuditDAOImpl

        public AbstractAuditDAOImpl()
    • Method Detail

      • setContentService

        public void setContentService​(ContentService contentService)
      • setContentDataDAO

        public void setContentDataDAO​(ContentDataDAO contentDataDAO)
      • setPropertyValueDAO

        public void setPropertyValueDAO​(PropertyValueDAO propertyValueDAO)
      • getOrCreateAuditModel

        public org.alfresco.util.Pair<java.lang.Long,​org.alfresco.service.cmr.repository.ContentData> getOrCreateAuditModel​(java.net.URL url)
        Creates a new audit model entry or finds an existing one
        Specified by:
        getOrCreateAuditModel in interface AuditDAO
        Parameters:
        url - the URL of the configuration
        Returns:
        Returns the ID of the config matching the input stream and the content storage details
      • getAuditModelByCrc

        protected abstract AuditModelEntity getAuditModelByCrc​(long crc)
      • createAuditModel

        protected abstract AuditModelEntity createAuditModel​(java.lang.Long contentDataId,
                                                             long crc)
      • getAuditApplication

        public AuditDAO.AuditApplicationInfo getAuditApplication​(java.lang.String application)
        Description copied from interface: AuditDAO
        Get the audit application details.
        Specified by:
        getAuditApplication in interface AuditDAO
        Parameters:
        application - the name of the application
        Returns:
        Returns details of an existing application or null if it doesn't exist
      • createAuditApplication

        public AuditDAO.AuditApplicationInfo createAuditApplication​(java.lang.String application,
                                                                    java.lang.Long modelId)
        Description copied from interface: AuditDAO
        Creates a new audit application. The application name must be unique.
        Specified by:
        createAuditApplication in interface AuditDAO
        Parameters:
        application - the name of the application
        modelId - the ID of the model configuration
      • updateAuditApplicationModel

        public void updateAuditApplicationModel​(java.lang.Long id,
                                                java.lang.Long modelId)
        Description copied from interface: AuditDAO
        Update the audit application to refer to a new model. If the model did not change, then nothing will be done.
        Specified by:
        updateAuditApplicationModel in interface AuditDAO
        Parameters:
        id - the ID of the audit application
        modelId - the ID of the new model
      • updateAuditApplicationDisabledPaths

        public void updateAuditApplicationDisabledPaths​(java.lang.Long id,
                                                        java.util.Set<java.lang.String> disabledPaths)
        Description copied from interface: AuditDAO
        Update the audit application to hold a new set of disabled paths. If the value did not change, then nothing will be done.
        Specified by:
        updateAuditApplicationDisabledPaths in interface AuditDAO
        Parameters:
        id - the ID of the audit application
        disabledPaths - the new disabled paths
      • getAuditApplicationById

        protected abstract AuditApplicationEntity getAuditApplicationById​(java.lang.Long id)
      • getAuditApplicationByName

        protected abstract AuditApplicationEntity getAuditApplicationByName​(java.lang.String appName)
      • createAuditApplication

        protected abstract AuditApplicationEntity createAuditApplication​(java.lang.Long appNameId,
                                                                         java.lang.Long modelId,
                                                                         java.lang.Long disabledPathsId)
      • createAuditEntry

        public java.lang.Long createAuditEntry​(java.lang.Long applicationId,
                                               long time,
                                               java.lang.String username,
                                               java.util.Map<java.lang.String,​java.io.Serializable> values)
        Description copied from interface: AuditDAO
        Create a new audit entry with the given map of values.
        Specified by:
        createAuditEntry in interface AuditDAO
        Parameters:
        applicationId - an existing audit application ID
        time - the time (ms since epoch) to log the entry against
        username - the authenticated user (null if not present)
        values - the values to record
        Returns:
        Returns the unique entry ID
      • deleteAuditEntries

        public int deleteAuditEntries​(java.util.List<java.lang.Long> auditEntryIds)
        Description copied from interface: AuditDAO
        Delete a discrete list of audit entries. Duplicate entries are collapsed and the number of entries deleted will match the count of unique IDs in the list; otherwise a concurrency condition has occured and an exception will be generated.
        Specified by:
        deleteAuditEntries in interface AuditDAO
        Parameters:
        auditEntryIds - the IDs of all audit entries to delete
        Returns:
        Returns the number of entries deleted
      • createAuditEntry

        protected abstract AuditEntryEntity createAuditEntry​(java.lang.Long applicationId,
                                                             long time,
                                                             java.lang.Long usernameId,
                                                             java.lang.Long valuesId)
      • deleteAuditEntriesImpl

        protected abstract int deleteAuditEntriesImpl​(java.util.List<java.lang.Long> auditEntryIds)
      • findAuditEntries

        public void findAuditEntries​(AuditService.AuditQueryCallback callback,
                                     AuditQueryParameters parameters,
                                     int maxResults)
        Description copied from interface: AuditDAO
        Find audit entries using the given parameters, any of which may be null
        Specified by:
        findAuditEntries in interface AuditDAO
        Parameters:
        callback - the data callback per entry
        parameters - the parameters for the query (may not be null)
        maxResults - the maximum number of results to retrieve (must be greater than 0)
      • findAuditEntries

        protected abstract void findAuditEntries​(AbstractAuditDAOImpl.AuditQueryRowHandler rowHandler,
                                                 boolean forward,
                                                 java.lang.String applicationName,
                                                 java.lang.String user,
                                                 java.lang.Long fromId,
                                                 java.lang.Long toId,
                                                 java.lang.Long fromTime,
                                                 java.lang.Long toTime,
                                                 int maxResults,
                                                 java.lang.String searchKey,
                                                 java.io.Serializable searchValue)