mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-09-17 14:21:39 +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-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-transform-service.version>4.2.0</dependency.alfresco-transform-service.version>
|
||||||
<dependency.alfresco-greenmail.version>7.1</dependency.alfresco-greenmail.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.aspectj.version>1.9.22.1</dependency.aspectj.version>
|
||||||
<dependency.spring.version>6.2.8</dependency.spring.version>
|
<dependency.spring.version>6.2.8</dependency.spring.version>
|
||||||
|
@@ -766,7 +766,7 @@ public class AuditComponentImpl implements AuditComponent
|
|||||||
}
|
}
|
||||||
if (isAuditingToAuditStorageEnabled())
|
if (isAuditingToAuditStorageEnabled())
|
||||||
{
|
{
|
||||||
auditRecordReporter.reportAuditRecord(createAuditRecord(auditData, true, application.getApplicationName()));
|
auditRecordReporter.reportAuditRecord(createAuditRecord(auditData, true, username, entryId, application.getApplicationName()));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Done
|
// Done
|
||||||
@@ -941,12 +941,14 @@ public class AuditComponentImpl implements AuditComponent
|
|||||||
* the name of the audit application
|
* the name of the audit application
|
||||||
* @return a constructed AuditRecord instance
|
* @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 + '/'.
|
int rootSize = applicationName.length() + 2; // Root is constructed like this -> '/' + auditedApplicationName + '/'.
|
||||||
AuditRecord.Builder builder = AuditRecordUtils.generateAuditRecordBuilder(auditData, rootSize);
|
AuditRecord.Builder builder = AuditRecordUtils.generateAuditRecordBuilder(auditData, rootSize);
|
||||||
builder.setAuditRecordType(applicationName);
|
builder.setAuditRecordType(applicationName);
|
||||||
builder.setInTransaction(inTransaction);
|
builder.setInTransaction(inTransaction);
|
||||||
|
builder.setUsername(username);
|
||||||
|
builder.setEntryDBId(entryId);
|
||||||
return builder.build();
|
return builder.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -34,6 +34,8 @@ public class AuditRecord
|
|||||||
private final boolean inTransaction;
|
private final boolean inTransaction;
|
||||||
private final String auditApplicationId;
|
private final String auditApplicationId;
|
||||||
private final ZonedDateTime createdAt;
|
private final ZonedDateTime createdAt;
|
||||||
|
private final String username;
|
||||||
|
private final Long entryDBId;
|
||||||
private final Map<String, Serializable> auditData;
|
private final Map<String, Serializable> auditData;
|
||||||
|
|
||||||
public AuditRecord(Builder builder)
|
public AuditRecord(Builder builder)
|
||||||
@@ -42,11 +44,8 @@ public class AuditRecord
|
|||||||
this.inTransaction = builder.inTransaction;
|
this.inTransaction = builder.inTransaction;
|
||||||
this.auditData = builder.auditRecordData;
|
this.auditData = builder.auditRecordData;
|
||||||
this.createdAt = ZonedDateTime.now();
|
this.createdAt = ZonedDateTime.now();
|
||||||
}
|
this.username = builder.username;
|
||||||
|
this.entryDBId = builder.entryDBId;
|
||||||
public boolean isInTransaction()
|
|
||||||
{
|
|
||||||
return inTransaction;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAuditApplicationId()
|
public String getAuditApplicationId()
|
||||||
@@ -54,11 +53,26 @@ public class AuditRecord
|
|||||||
return auditApplicationId;
|
return auditApplicationId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isInTransaction()
|
||||||
|
{
|
||||||
|
return inTransaction;
|
||||||
|
}
|
||||||
|
|
||||||
public ZonedDateTime getCreatedAt()
|
public ZonedDateTime getCreatedAt()
|
||||||
{
|
{
|
||||||
return createdAt;
|
return createdAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getUsername()
|
||||||
|
{
|
||||||
|
return username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getEntryDBId()
|
||||||
|
{
|
||||||
|
return entryDBId;
|
||||||
|
}
|
||||||
|
|
||||||
public Map<String, Serializable> getAuditData()
|
public Map<String, Serializable> getAuditData()
|
||||||
{
|
{
|
||||||
return auditData;
|
return auditData;
|
||||||
@@ -74,6 +88,8 @@ public class AuditRecord
|
|||||||
private String auditRecordType;
|
private String auditRecordType;
|
||||||
private boolean inTransaction;
|
private boolean inTransaction;
|
||||||
private Map<String, Serializable> auditRecordData;
|
private Map<String, Serializable> auditRecordData;
|
||||||
|
private String username;
|
||||||
|
private Long entryDBId;
|
||||||
|
|
||||||
public Builder setAuditRecordType(String auditRecordType)
|
public Builder setAuditRecordType(String auditRecordType)
|
||||||
{
|
{
|
||||||
@@ -93,6 +109,18 @@ public class AuditRecord
|
|||||||
return this;
|
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()
|
public AuditRecord build()
|
||||||
{
|
{
|
||||||
return new AuditRecord(this);
|
return new AuditRecord(this);
|
||||||
|
Reference in New Issue
Block a user