mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
RM-838 Searching for audit logs by event doesn't work for some events' types
- Added a new Spring config property 'auditedImmediately' to work alongside 'auditable' property to indicate that the action should be audited immediately rather than after transaction commits. The default value of 'auditedImmediately' is false unless it is specified as true by individual action in rm-action-context.xml. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/modules/recordsmanagement/HEAD@55259 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -478,7 +478,9 @@
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="relinquishHold" class="org.alfresco.module.org_alfresco_module_rm.action.impl.RelinquishHoldAction" parent="rmAction" />
|
||||
<bean id="relinquishHold" class="org.alfresco.module.org_alfresco_module_rm.action.impl.RelinquishHoldAction" parent="rmAction">
|
||||
<property name="auditedImmediately" value="true"/>
|
||||
</bean>
|
||||
|
||||
<!-- Edit hold reason -->
|
||||
|
||||
@@ -714,6 +716,7 @@
|
||||
</bean>
|
||||
|
||||
<bean id="transferComplete" class="org.alfresco.module.org_alfresco_module_rm.action.impl.TransferCompleteAction" parent="rmAction" >
|
||||
<property name="auditedImmediately" value="true"/>
|
||||
</bean>
|
||||
|
||||
<!-- accession -->
|
||||
@@ -758,6 +761,7 @@
|
||||
</bean>
|
||||
|
||||
<bean id="accessionComplete" class="org.alfresco.module.org_alfresco_module_rm.action.impl.TransferCompleteAction" parent="rmAction">
|
||||
<property name="auditedImmediately" value="true"/>
|
||||
</bean>
|
||||
|
||||
<!-- Split Email -->
|
||||
|
@@ -37,6 +37,9 @@ public abstract class AuditableActionExecuterAbstractBase extends ActionExecuter
|
||||
/** Indicates whether the action is auditable or not */
|
||||
protected boolean auditable = true;
|
||||
|
||||
/** Indicates whether the action is audited immediately or not */
|
||||
protected boolean auditedImmediately = false;
|
||||
|
||||
/** Application context */
|
||||
protected ApplicationContext applicationContext;
|
||||
|
||||
@@ -51,6 +54,14 @@ public abstract class AuditableActionExecuterAbstractBase extends ActionExecuter
|
||||
this.auditable = auditable;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param auditedImmediately true if to be audited immediately, false to be audited after transaction commits
|
||||
*/
|
||||
public void setAuditedImmediately(boolean auditedImmediately)
|
||||
{
|
||||
this.auditedImmediately = auditedImmediately;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.springframework.context.ApplicationContextAware#setApplicationContext(org.springframework.context.ApplicationContext)
|
||||
*/
|
||||
@@ -95,13 +106,22 @@ public abstract class AuditableActionExecuterAbstractBase extends ActionExecuter
|
||||
@Override
|
||||
public void execute(Action action, NodeRef actionedUponNodeRef)
|
||||
{
|
||||
// execute the action
|
||||
super.execute(action, actionedUponNodeRef);
|
||||
|
||||
// audit the execution of the action
|
||||
if (auditable == true)
|
||||
{
|
||||
getAuditService().auditEvent(actionedUponNodeRef, this.getActionDefinition().getName());
|
||||
if (auditedImmediately == true)
|
||||
{
|
||||
// To be audited immediately before the action is executed, eg. to audit before actionedUponNodeRef gets deleted during the execution.
|
||||
getAuditService().auditEvent(actionedUponNodeRef, this.getActionDefinition().getName(), null, null);
|
||||
}
|
||||
else
|
||||
{
|
||||
// To be stacked up with other audit entries and audited after the transaction commits.
|
||||
getAuditService().auditEvent(actionedUponNodeRef, this.getActionDefinition().getName());
|
||||
}
|
||||
}
|
||||
|
||||
// execute the action
|
||||
super.execute(action, actionedUponNodeRef);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user