mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-09-10 14:11:58 +00:00
[ACS-9736] Switch to latest acs-event-model
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.6-SNAPSHOT</dependency.acs-event-model.version>
|
||||
<dependency.acs-event-model.version>1.0.7</dependency.acs-event-model.version>
|
||||
|
||||
<dependency.aspectj.version>1.9.22.1</dependency.aspectj.version>
|
||||
<dependency.spring.version>6.2.8</dependency.spring.version>
|
||||
|
@@ -940,7 +940,7 @@ public class AuditComponentImpl implements AuditComponent
|
||||
* the name of the audit application
|
||||
* @return a constructed AuditRecord instance
|
||||
*/
|
||||
private AuditRecord createAuditRecord(Map<String, ?> auditData, boolean inTransaction, String applicationName)
|
||||
private AuditRecord createAuditRecord(Map<String, Serializable> auditData, boolean inTransaction, String applicationName)
|
||||
{
|
||||
int rootSize = applicationName.length() + 2; // Root is constructed like this -> '/' + auditedApplicationName + '/'.
|
||||
AuditRecord.Builder builder = AuditRecordUtils.generateAuditRecordBuilder(auditData, rootSize);
|
||||
|
@@ -25,6 +25,7 @@
|
||||
*/
|
||||
package org.alfresco.repo.audit;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -33,7 +34,7 @@ public class AuditRecord
|
||||
private final boolean inTransaction;
|
||||
private final String auditApplicationId;
|
||||
private final ZonedDateTime createdAt;
|
||||
private final Map<String, ?> auditData;
|
||||
private final Map<String, Serializable> auditData;
|
||||
|
||||
public AuditRecord(Builder builder)
|
||||
{
|
||||
@@ -58,7 +59,7 @@ public class AuditRecord
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public Map<String, ?> getAuditData()
|
||||
public Map<String, Serializable> getAuditData()
|
||||
{
|
||||
return auditData;
|
||||
}
|
||||
@@ -72,7 +73,7 @@ public class AuditRecord
|
||||
{
|
||||
private String auditApplicationId;
|
||||
private boolean inTransaction;
|
||||
private Map<String, ?> auditData;
|
||||
private Map<String, Serializable> auditData;
|
||||
|
||||
public Builder setAuditApplicationId(String auditApplicationId)
|
||||
{
|
||||
@@ -86,7 +87,7 @@ public class AuditRecord
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setAuditData(Map<String, ?> auditData)
|
||||
public Builder setAuditData(Map<String, Serializable> auditData)
|
||||
{
|
||||
this.auditData = auditData;
|
||||
return this;
|
||||
|
@@ -25,6 +25,7 @@
|
||||
*/
|
||||
package org.alfresco.repo.audit;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -40,10 +41,10 @@ public class AuditRecordUtils
|
||||
* @return a preloaded {@link AuditRecord.Builder}
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public static AuditRecord.Builder generateAuditRecordBuilder(Map<String, ?> data, int keyRootLength)
|
||||
public static AuditRecord.Builder generateAuditRecordBuilder(Map<String, Serializable> data, int keyRootLength)
|
||||
{
|
||||
var auditRecordBuilder = AuditRecord.builder();
|
||||
var rootNode = new HashMap<String, Object>();
|
||||
var rootNode = new HashMap<String, Serializable>();
|
||||
|
||||
data.forEach((k, v) -> {
|
||||
var keys = k.substring(keyRootLength).split("/");
|
||||
@@ -51,7 +52,7 @@ public class AuditRecordUtils
|
||||
var current = rootNode;
|
||||
for (int i = 0; i < keys.length - 1; i++)
|
||||
{
|
||||
current = (HashMap<String, Object>) current.computeIfAbsent(keys[i], newMap -> new HashMap<String, Object>());
|
||||
current = (HashMap<String, Serializable>) current.computeIfAbsent(keys[i], newMap -> new HashMap<String, Serializable>());
|
||||
}
|
||||
current.put(keys[keys.length - 1], v);
|
||||
});
|
||||
|
@@ -26,17 +26,17 @@
|
||||
|
||||
package org.alfresco.repo.audit;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.Instant;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.alfresco.service.namespace.QName;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
|
||||
public class AuditRecordUtilsTest
|
||||
{
|
||||
@@ -44,14 +44,14 @@ public class AuditRecordUtilsTest
|
||||
@SuppressWarnings("unchecked")
|
||||
public void generateAuditRecordBuilderTest()
|
||||
{
|
||||
var testData = new HashMap<String, Object>();
|
||||
var testData = new HashMap<String, Serializable>();
|
||||
|
||||
testData.put("/alfresco-access/transaction/path", "/app:company_home");
|
||||
testData.put("/alfresco-access/transaction/user", "admin");
|
||||
testData.put("/alfresco-access/transaction/sub-actions", "updateNodeProperties");
|
||||
var now = Instant.now();
|
||||
testData.put("/alfresco-access/transaction/properties/from", Map.of(QName.createQName("modified"), Date.from(now)));
|
||||
testData.put("/alfresco-access/transaction/properties/to", Map.of(QName.createQName("modified"), Date.from(now)));
|
||||
testData.put("/alfresco-access/transaction/properties/from", (Serializable) Map.of(QName.createQName("modified"), Date.from(now)));
|
||||
testData.put("/alfresco-access/transaction/properties/to", (Serializable) Map.of(QName.createQName("modified"), Date.from(now)));
|
||||
|
||||
var builder = AuditRecordUtils.generateAuditRecordBuilder(testData, "/alfresco-access/".length());
|
||||
builder.setAuditApplicationId("alfresco-access");
|
||||
|
Reference in New Issue
Block a user