Package org.alfresco.repo.audit.model
Class AuditApplication
- java.lang.Object
-
- org.alfresco.repo.audit.model.AuditApplication
-
public class AuditApplication extends java.lang.ObjectHelper class that wraps theaudit application. Once wrapped, client code doesn't need access to any of the generated model-driven classes.- Since:
- 3.2
- Author:
- Derek Hulley
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAuditApplication.DataExtractorDefinitionUtility class carrying information around aDataExtractor.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringAUDIT_APPLICATION_PREFIX_FOR_PRE_DATAstatic java.util.regex.PatternAUDIT_INVALID_PATH_COMP_CHAR_PATTERNstatic java.util.regex.PatternAUDIT_KEY_PATTERNstatic java.util.regex.PatternAUDIT_PATH_PATTERNstatic java.lang.StringAUDIT_PATH_SEPARATOR
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static java.lang.StringbuildPath(java.lang.String... pathComponents)Compile a path or part of a path into a single string which always starts with theAUDIT_PATH_SEPARATOR.voidcheckPath(java.lang.String path)Helper method to check that a path is correct for this application instancestatic voidcheckPathFormat(java.lang.String path)Helper method to check that a path is correct for this application instancebooleanequals(java.lang.Object obj)java.lang.LonggetApplicationId()Get the database ID for this applicationjava.lang.StringgetApplicationKey()Get the key (root path) for the applicationjava.lang.StringgetApplicationName()Get the application namejava.util.List<AuditApplication.DataExtractorDefinition>getDataExtractors()Get all data extractors applicable to this application.java.util.Map<java.lang.String,DataGenerator>getDataGenerators(java.lang.String path)Get all data generators applicable to a given path and scope.java.util.Map<java.lang.String,DataGenerator>getDataGenerators(java.util.Set<java.lang.String> paths)Get all data generators applicable to a given path and scope.java.lang.LonggetDisabledPathsId()Get the property representing the set of disabled paths for the applicationstatic java.lang.StringgetRootKey(java.lang.String path)inthashCode()booleanisApplicationJustGeneratingPreCallData()Returnstrueif the application name has a prefix of"PreCallData"that indicates that the only purpose of the Application is to generate data to be passed to a post call audit application.java.lang.StringtoString()
-
-
-
Field Detail
-
AUDIT_APPLICATION_PREFIX_FOR_PRE_DATA
public static final java.lang.String AUDIT_APPLICATION_PREFIX_FOR_PRE_DATA
- See Also:
- Constant Field Values
-
AUDIT_PATH_SEPARATOR
public static final java.lang.String AUDIT_PATH_SEPARATOR
- See Also:
- Constant Field Values
-
AUDIT_KEY_PATTERN
public static final java.util.regex.Pattern AUDIT_KEY_PATTERN
-
AUDIT_PATH_PATTERN
public static final java.util.regex.Pattern AUDIT_PATH_PATTERN
-
AUDIT_INVALID_PATH_COMP_CHAR_PATTERN
public static final java.util.regex.Pattern AUDIT_INVALID_PATH_COMP_CHAR_PATTERN
-
-
Method Detail
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
getApplicationName
public java.lang.String getApplicationName()
Get the application name
-
getApplicationKey
public java.lang.String getApplicationKey()
Get the key (root path) for the application
-
getApplicationId
public java.lang.Long getApplicationId()
Get the database ID for this application
-
getDisabledPathsId
public java.lang.Long getDisabledPathsId()
Get the property representing the set of disabled paths for the application- Returns:
- Returns an ID of disabled paths
-
checkPath
public void checkPath(java.lang.String path)
Helper method to check that a path is correct for this application instance- Parameters:
path- the path in format /app-key/x/y/z- Throws:
AuditModelException- if the path is invalid- See Also:
AUDIT_PATH_PATTERN
-
checkPathFormat
public static void checkPathFormat(java.lang.String path)
Helper method to check that a path is correct for this application instance- Parameters:
path- the path in format /app-key/x/y/z- Throws:
AuditModelException- if the path is invalid- See Also:
AUDIT_PATH_PATTERN
-
buildPath
public static java.lang.String buildPath(java.lang.String... pathComponents)
Compile a path or part of a path into a single string which always starts with theAUDIT_PATH_SEPARATOR. This can be a relative path so need not always start with the application root key.If the path separator is present at the beginning of a path component, then it is not added, so
"/a", "b", "/c"becomes"/a/b/c"allowing path to be appended to other paths.The final result is checked against a
regular expressionto ensure it is valid.- Parameters:
pathComponents- the elements of the path e.g."a", "b", "c".- Returns:
- Returns the compiled path e.g
"/a/b/c".
-
getRootKey
public static java.lang.String getRootKey(java.lang.String path)
- Parameters:
path- the audit path for form /abc/def- Returns:
- the root key of form abc
-
getDataExtractors
public java.util.List<AuditApplication.DataExtractorDefinition> getDataExtractors()
Get all data extractors applicable to this application.- Returns:
- Returns all data extractors contained in the application
-
getDataGenerators
public java.util.Map<java.lang.String,DataGenerator> getDataGenerators(java.lang.String path)
Get all data generators applicable to a given path and scope.- Parameters:
path- the audit path- Returns:
- Returns all data generators mapped to their key-path
-
getDataGenerators
public java.util.Map<java.lang.String,DataGenerator> getDataGenerators(java.util.Set<java.lang.String> paths)
Get all data generators applicable to a given path and scope.- Parameters:
paths- the audit paths- Returns:
- Returns all data generators mapped to their key-path
-
isApplicationJustGeneratingPreCallData
public boolean isApplicationJustGeneratingPreCallData()
Returnstrueif the application name has a prefix of"PreCallData"that indicates that the only purpose of the Application is to generate data to be passed to a post call audit application. In this situation the application's audit data is not audited. This allows the post audit application to have access to 'before' values including those created by extractors and generators. Some of which will not be available (for example the node has been deleted) or will have changed as a result of the call.
-
-