Class AuditModelRegistryImpl

java.lang.Object
org.alfresco.repo.management.subsystems.AbstractPropertyBackedBean
org.alfresco.repo.audit.model.AuditModelRegistryImpl
All Implemented Interfaces:
EventListener, AuditModelRegistry, PropertyBackedBean, PropertyBackedBeanState, org.springframework.beans.factory.Aware, org.springframework.beans.factory.BeanNameAware, org.springframework.beans.factory.DisposableBean, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware, org.springframework.context.ApplicationListener<org.springframework.context.ApplicationEvent>

public class AuditModelRegistryImpl extends AbstractPropertyBackedBean implements AuditModelRegistry
Component used to store audit model definitions. It ensures that duplicate application and converter definitions are detected and provides a single lookup for code using the Audit model. It is factored as a subsystem and exposes a global enablement property plus enablement properties for each individual audit application.
Since:
3.2
Author:
Derek Hulley, dward
  • Field Details

    • PROPERTY_AUDIT_ENABLED

      public static final String PROPERTY_AUDIT_ENABLED
      The name of the global enablement property.
      See Also:
    • PROPERTY_AUDIT_CONFIG_STRICT

      public static final String PROPERTY_AUDIT_CONFIG_STRICT
      The name of the strict loading flag.
      See Also:
  • Constructor Details

    • AuditModelRegistryImpl

      public AuditModelRegistryImpl()
      Default constructor.
  • Method Details

    • setSearchPath

      public void setSearchPath(String[] searchPath)
      Sets the search path for config files.
    • setTransactionService

      public void setTransactionService(TransactionService transactionService)
      Service to ensure DAO calls are transactionally wrapped.
    • setAuditDAO

      public void setAuditDAO(AuditDAO auditDAO)
      Set the DAO used to persisted the registered audit models.
    • setDataExtractors

      public void setDataExtractors(org.alfresco.util.registry.NamedObjectRegistry<DataExtractor> dataExtractors)
      Set the registry of data extractors.
    • setDataGenerators

      public void setDataGenerators(org.alfresco.util.registry.NamedObjectRegistry<DataGenerator> dataGenerators)
      Set the registry of data generators.
    • afterPropertiesSet

      public void afterPropertiesSet() throws Exception
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
      Overrides:
      afterPropertiesSet in class AbstractPropertyBackedBean
      Throws:
      Exception
    • getAuditApplications

      public Map<String,AuditApplication> getAuditApplications()
      Get a map of all audit applications key by name
      Specified by:
      getAuditApplications in interface AuditModelRegistry
      Returns:
      the audit applications
    • getAuditApplicationByKey

      public AuditApplication getAuditApplicationByKey(String key)
      Get the application model for the given root key (as defined on the application)
      Specified by:
      getAuditApplicationByKey in interface AuditModelRegistry
      Parameters:
      key - the key defined on the application
      Returns:
      the java model (null if not found)
    • getAuditApplicationByName

      public AuditApplication getAuditApplicationByName(String applicationName)
      Get the application model for the given application name
      Specified by:
      getAuditApplicationByName in interface AuditModelRegistry
      Parameters:
      applicationName - the name of the audited application
      Returns:
      the java model (null if not found)
    • getAuditPathMapper

      public PathMapper getAuditPathMapper()
      Get the path mapper.
      Specified by:
      getAuditPathMapper in interface AuditModelRegistry
      Returns:
      the path mapper
    • loadAuditModels

      public void loadAuditModels()
      Method to load audit models into memory. This method is also responsible for persisting the audit models for later retrieval.

      Note, the models are loaded in a new transaction, so this method can be called by any code at any time.

      Specified by:
      loadAuditModels in interface AuditModelRegistry
    • isAuditEnabled

      public boolean isAuditEnabled()
      Determines whether audit is globally enabled or disabled.
      Specified by:
      isAuditEnabled in interface AuditModelRegistry
      Returns:
      true if audit is enabled
    • isAuditingToDatabaseEnabled

      public boolean isAuditingToDatabaseEnabled()
      Determines whether audit values should be stored in database. True by default if not changed by property.
      Specified by:
      isAuditingToDatabaseEnabled in interface AuditModelRegistry
      Returns:
      true if audit is enabled.
    • isAuditingToAuditStorageEnabled

      public boolean isAuditingToAuditStorageEnabled()
      Determines whether audit values should be stored in audit storage.
      Specified by:
      isAuditingToAuditStorageEnabled in interface AuditModelRegistry
      Returns:
      true if auditing to Audit Storage is enabled.
    • registerModel

      public void registerModel(URL auditModelUrl)
      Enables audit and registers an audit model at a given URL. Does not register across the cluster and should only be used for unit test purposes.
      Parameters:
      auditModelUrl - the source of the model
    • createInitialState

      protected PropertyBackedBeanState createInitialState() throws IOException
      Creates the initial state.
      Specified by:
      createInitialState in class AbstractPropertyBackedBean
      Returns:
      the property backed bean state
      Throws:
      IOException - Signals that an I/O exception has occurred.
    • unmarshallModel

      public static Audit unmarshallModel(URL configUrl)
      Unmarshalls the Audit model from the URL.
      Parameters:
      configUrl - the config url
      Returns:
      the audit model
      Throws:
      org.alfresco.error.AlfrescoRuntimeException - if an IOException occurs