mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-09-10 14:11:58 +00:00
[ACS-9736] Enhance audit record creation with username and entry ID parameters
This commit is contained in:
2
pom.xml
2
pom.xml
@@ -54,7 +54,7 @@
|
||||
<dependency.alfresco-transform-core.version>5.2.0-A.3</dependency.alfresco-transform-core.version>
|
||||
<dependency.alfresco-transform-service.version>4.2.0</dependency.alfresco-transform-service.version>
|
||||
<dependency.alfresco-greenmail.version>7.1</dependency.alfresco-greenmail.version>
|
||||
<dependency.acs-event-model.version>1.0.8</dependency.acs-event-model.version>
|
||||
<dependency.acs-event-model.version>1.0.9</dependency.acs-event-model.version>
|
||||
|
||||
<dependency.aspectj.version>1.9.22.1</dependency.aspectj.version>
|
||||
<dependency.spring.version>6.2.8</dependency.spring.version>
|
||||
|
@@ -766,7 +766,7 @@ public class AuditComponentImpl implements AuditComponent
|
||||
}
|
||||
if (isAuditingToAuditStorageEnabled())
|
||||
{
|
||||
auditRecordReporter.reportAuditRecord(createAuditRecord(auditData, true, application.getApplicationName()));
|
||||
auditRecordReporter.reportAuditRecord(createAuditRecord(auditData, true, username, entryId, application.getApplicationName()));
|
||||
}
|
||||
|
||||
// Done
|
||||
@@ -941,12 +941,14 @@ public class AuditComponentImpl implements AuditComponent
|
||||
* the name of the audit application
|
||||
* @return a constructed AuditRecord instance
|
||||
*/
|
||||
private AuditRecord createAuditRecord(Map<String, Serializable> auditData, boolean inTransaction, String applicationName)
|
||||
private AuditRecord createAuditRecord(Map<String, Serializable> auditData, boolean inTransaction, String username, Long entryId, String applicationName)
|
||||
{
|
||||
int rootSize = applicationName.length() + 2; // Root is constructed like this -> '/' + auditedApplicationName + '/'.
|
||||
AuditRecord.Builder builder = AuditRecordUtils.generateAuditRecordBuilder(auditData, rootSize);
|
||||
builder.setAuditRecordType(applicationName);
|
||||
builder.setInTransaction(inTransaction);
|
||||
builder.setUsername(username);
|
||||
builder.setEntryDBId(entryId);
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
|
@@ -34,6 +34,8 @@ public class AuditRecord
|
||||
private final boolean inTransaction;
|
||||
private final String auditApplicationId;
|
||||
private final ZonedDateTime createdAt;
|
||||
private final String username;
|
||||
private final Long entryDBId;
|
||||
private final Map<String, Serializable> auditData;
|
||||
|
||||
public AuditRecord(Builder builder)
|
||||
@@ -42,11 +44,8 @@ public class AuditRecord
|
||||
this.inTransaction = builder.inTransaction;
|
||||
this.auditData = builder.auditRecordData;
|
||||
this.createdAt = ZonedDateTime.now();
|
||||
}
|
||||
|
||||
public boolean isInTransaction()
|
||||
{
|
||||
return inTransaction;
|
||||
this.username = builder.username;
|
||||
this.entryDBId = builder.entryDBId;
|
||||
}
|
||||
|
||||
public String getAuditApplicationId()
|
||||
@@ -54,11 +53,26 @@ public class AuditRecord
|
||||
return auditApplicationId;
|
||||
}
|
||||
|
||||
public boolean isInTransaction()
|
||||
{
|
||||
return inTransaction;
|
||||
}
|
||||
|
||||
public ZonedDateTime getCreatedAt()
|
||||
{
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public String getUsername()
|
||||
{
|
||||
return username;
|
||||
}
|
||||
|
||||
public Long getEntryDBId()
|
||||
{
|
||||
return entryDBId;
|
||||
}
|
||||
|
||||
public Map<String, Serializable> getAuditData()
|
||||
{
|
||||
return auditData;
|
||||
@@ -74,6 +88,8 @@ public class AuditRecord
|
||||
private String auditRecordType;
|
||||
private boolean inTransaction;
|
||||
private Map<String, Serializable> auditRecordData;
|
||||
private String username;
|
||||
private Long entryDBId;
|
||||
|
||||
public Builder setAuditRecordType(String auditRecordType)
|
||||
{
|
||||
@@ -93,6 +109,18 @@ public class AuditRecord
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setUsername(String username)
|
||||
{
|
||||
this.username = username;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setEntryDBId(Long entryDBId)
|
||||
{
|
||||
this.entryDBId = entryDBId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public AuditRecord build()
|
||||
{
|
||||
return new AuditRecord(this);
|
||||
|
Reference in New Issue
Block a user