mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
[MNT-24137] Audit Issue Internal Server Error fix (#2786)
* [MNT-24137][ags][tas] Audit Bug Fix * [MNT-24137][ags][tas] Audit Bug Fix * [MNT-24137][ags][tas] Audit Bug Fix * [MNT-24137][ags][tas] Audit Bug Fix * [MNT-24137][ags][tas] Audit Bug Fix * [MNT-24137][ags][tas] Audit Bug Fix * [MNT-24137][ags][tas] Audit Bug Fix --------- Co-authored-by: Sathish Kumar <ST28@ford.com>
This commit is contained in:
@@ -93,15 +93,15 @@ public class RMv33HoldAuditEntryValuesPatchUnitTest
|
|||||||
verify(mockedRecordsManagementQueryDAO, times(1)).updatePropertyStringValueEntity(deleteHoldPropertyStringValueEntity);
|
verify(mockedRecordsManagementQueryDAO, times(1)).updatePropertyStringValueEntity(deleteHoldPropertyStringValueEntity);
|
||||||
|
|
||||||
assertEquals("Add To Hold", addToHoldPropertyStringValueEntity.getStringValue());
|
assertEquals("Add To Hold", addToHoldPropertyStringValueEntity.getStringValue());
|
||||||
assertEquals("add to hold", addToHoldPropertyStringValueEntity.getStringEndLower());
|
assertEquals("add to hold", addToHoldPropertyStringValueEntity.getStringLower());
|
||||||
assertEquals(Long.valueOf(770_786_109L), addToHoldPropertyStringValueEntity.getStringCrc());
|
assertEquals(Long.valueOf(770_786_109L), addToHoldPropertyStringValueEntity.getStringCrc());
|
||||||
|
|
||||||
assertEquals("Remove From Hold", removeFromHoldPropertyStringValueEntity.getStringValue());
|
assertEquals("Remove From Hold", removeFromHoldPropertyStringValueEntity.getStringValue());
|
||||||
assertEquals("remove from hold", removeFromHoldPropertyStringValueEntity.getStringEndLower());
|
assertEquals("remove from hold", removeFromHoldPropertyStringValueEntity.getStringLower());
|
||||||
assertEquals(Long.valueOf(2_967_613_012L), removeFromHoldPropertyStringValueEntity.getStringCrc());
|
assertEquals(Long.valueOf(2_967_613_012L), removeFromHoldPropertyStringValueEntity.getStringCrc());
|
||||||
|
|
||||||
assertEquals("Delete Hold", deleteHoldPropertyStringValueEntity.getStringValue());
|
assertEquals("Delete Hold", deleteHoldPropertyStringValueEntity.getStringValue());
|
||||||
assertEquals("delete hold", deleteHoldPropertyStringValueEntity.getStringEndLower());
|
assertEquals("delete hold", deleteHoldPropertyStringValueEntity.getStringLower());
|
||||||
assertEquals(Long.valueOf(132_640_810L), deleteHoldPropertyStringValueEntity.getStringCrc());
|
assertEquals(Long.valueOf(132_640_810L), deleteHoldPropertyStringValueEntity.getStringCrc());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Remote API
|
* Alfresco Remote API
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
* Copyright (C) 2005 - 2024 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
@@ -909,16 +909,14 @@ public class AuditImpl implements Audit
|
|||||||
|
|
||||||
public int getAuditEntriesCountByAppAndProperties(AuditService.AuditApplication auditApplication, AuditEntryQueryWalker propertyWalker)
|
public int getAuditEntriesCountByAppAndProperties(AuditService.AuditApplication auditApplication, AuditEntryQueryWalker propertyWalker)
|
||||||
{
|
{
|
||||||
final String applicationName = auditApplication.getKey().substring(1);
|
|
||||||
|
|
||||||
AuditQueryParameters parameters = new AuditQueryParameters();
|
AuditQueryParameters parameters = new AuditQueryParameters();
|
||||||
parameters.setApplicationName(applicationName);
|
parameters.setApplicationName(auditApplication.getName());
|
||||||
parameters.setFromTime(propertyWalker.getFromTime());
|
parameters.setFromTime(propertyWalker.getFromTime());
|
||||||
parameters.setToTime(propertyWalker.getToTime());
|
parameters.setToTime(propertyWalker.getToTime());
|
||||||
parameters.setFromId(propertyWalker.getFromId());
|
parameters.setFromId(propertyWalker.getFromId());
|
||||||
parameters.setToId(propertyWalker.getToId());
|
parameters.setToId(propertyWalker.getToId());
|
||||||
parameters.setUser(propertyWalker.getCreatedByUser());
|
parameters.setUser(propertyWalker.getCreatedByUser());
|
||||||
|
|
||||||
return auditService.getAuditEntriesCountByAppAndProperties(applicationName, parameters);
|
return auditService.getAuditEntriesCountByAppAndProperties(parameters);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
* Copyright (C) 2005 - 2024 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
@@ -276,11 +276,10 @@ public interface AuditComponent
|
|||||||
/**
|
/**
|
||||||
* Issue an audit query to retrieve count of records for a given application and properties
|
* Issue an audit query to retrieve count of records for a given application and properties
|
||||||
*
|
*
|
||||||
* @param applicationName the name of the application
|
|
||||||
* @param parameters audit parameters provided by the <code>where</code> clause on the ReST API
|
* @param parameters audit parameters provided by the <code>where</code> clause on the ReST API
|
||||||
* @return a map containing min/max and the associated value
|
* @return a map containing min/max and the associated value
|
||||||
*/
|
*/
|
||||||
default int getAuditEntriesCountByAppAndProperties(String applicationName, AuditQueryParameters parameters)
|
default int getAuditEntriesCountByAppAndProperties(AuditQueryParameters parameters)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
* Copyright (C) 2005 - 2024 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
@@ -956,10 +956,8 @@ public class AuditComponentImpl implements AuditComponent
|
|||||||
return auditDAO.getAuditEntriesCountByApp(applicationId);
|
return auditDAO.getAuditEntriesCountByApp(applicationId);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override public int getAuditEntriesCountByAppAndProperties(String applicationName, AuditQueryParameters parameters)
|
@Override public int getAuditEntriesCountByAppAndProperties(AuditQueryParameters parameters)
|
||||||
{
|
{
|
||||||
org.alfresco.repo.domain.audit.AuditQueryParameters dbParameters = new org.alfresco.repo.domain.audit.AuditQueryParameters();
|
return auditDAO.getAuditEntriesCountByAppAndProperties(parameters);
|
||||||
|
|
||||||
return auditDAO.getAuditEntriesCountByAppAndProperties(applicationName, parameters);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
* Copyright (C) 2005 - 2024 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
@@ -190,8 +190,8 @@ public class AuditServiceImpl implements AuditService
|
|||||||
/**
|
/**
|
||||||
* {@inheritDoc}
|
* {@inheritDoc}
|
||||||
*/
|
*/
|
||||||
@Override public int getAuditEntriesCountByAppAndProperties(String applicationName, AuditQueryParameters parameters)
|
@Override public int getAuditEntriesCountByAppAndProperties(AuditQueryParameters parameters)
|
||||||
{
|
{
|
||||||
return auditComponent.getAuditEntriesCountByAppAndProperties(applicationName, parameters);
|
return auditComponent.getAuditEntriesCountByAppAndProperties(parameters);
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
* Copyright (C) 2005 - 2024 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
@@ -102,20 +102,21 @@ public class CrcHelper
|
|||||||
{
|
{
|
||||||
throw new RuntimeException("UTF-8 encoding is not supported");
|
throw new RuntimeException("UTF-8 encoding is not supported");
|
||||||
}
|
}
|
||||||
// Get the short value (case-sensitive or not)
|
// Crc Value will change based on the case-sensitive, So we need to get the short value based on case-sensitive
|
||||||
String valueShort = null;
|
String valueShort = null;
|
||||||
int valueLen = valueLowerCase.length();
|
String currentValue = caseSensitive ? value : valueLowerCase;
|
||||||
|
int valueLen = currentValue.length();
|
||||||
if (valueLen < dataLength)
|
if (valueLen < dataLength)
|
||||||
{
|
{
|
||||||
valueShort = valueLowerCase;
|
valueShort = currentValue;
|
||||||
}
|
}
|
||||||
else if (useCharsFromStart)
|
else if (useCharsFromStart)
|
||||||
{
|
{
|
||||||
valueShort = valueLowerCase.substring(0, dataLength - 1);
|
valueShort = currentValue.substring(0, dataLength - 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
valueShort = valueLowerCase.substring(valueLen - dataLength);
|
valueShort = currentValue.substring(valueLen - dataLength);
|
||||||
}
|
}
|
||||||
return new Pair<String, Long>(valueShort, valueCrc);
|
return new Pair<String, Long>(valueShort, valueCrc);
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
* Copyright (C) 2005 - 2024 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
@@ -248,11 +248,10 @@ public interface AuditDAO
|
|||||||
/**
|
/**
|
||||||
* Issue an audit query to retrieve count of records for a given application and properties
|
* Issue an audit query to retrieve count of records for a given application and properties
|
||||||
*
|
*
|
||||||
* @param applicationName name of the application to be queried
|
|
||||||
* @param parameters audit parameters provided by the <code>where</code> clause on the ReST API
|
* @param parameters audit parameters provided by the <code>where</code> clause on the ReST API
|
||||||
* @return a map containing min/max and the associated value
|
* @return a map containing min/max and the associated value
|
||||||
*/
|
*/
|
||||||
default int getAuditEntriesCountByAppAndProperties(String applicationName, org.alfresco.service.cmr.audit.AuditQueryParameters parameters)
|
default int getAuditEntriesCountByAppAndProperties(org.alfresco.service.cmr.audit.AuditQueryParameters parameters)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
* Copyright (C) 2005 - 2024 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
@@ -237,7 +237,7 @@ public class AuditDAOImpl extends AbstractAuditDAOImpl
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getAuditEntriesCountByAppAndProperties(String applicationName, org.alfresco.service.cmr.audit.AuditQueryParameters parameters)
|
public int getAuditEntriesCountByAppAndProperties(org.alfresco.service.cmr.audit.AuditQueryParameters parameters)
|
||||||
{
|
{
|
||||||
AuditQueryParameters dbParameters = convertFromRestAuditQueryParameters(parameters);
|
AuditQueryParameters dbParameters = convertFromRestAuditQueryParameters(parameters);
|
||||||
|
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
* Copyright (C) 2005 - 2024 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
@@ -44,6 +44,7 @@ public class PropertyStringValueEntity
|
|||||||
private String stringValue;
|
private String stringValue;
|
||||||
private String stringEndLower;
|
private String stringEndLower;
|
||||||
private Long stringCrc;
|
private Long stringCrc;
|
||||||
|
private String stringLower;
|
||||||
|
|
||||||
public PropertyStringValueEntity()
|
public PropertyStringValueEntity()
|
||||||
{
|
{
|
||||||
@@ -115,6 +116,9 @@ public class PropertyStringValueEntity
|
|||||||
Pair<String, Long> crcPair = CrcHelper.getStringCrcPair(value, 16, false, true);
|
Pair<String, Long> crcPair = CrcHelper.getStringCrcPair(value, 16, false, true);
|
||||||
stringEndLower = crcPair.getFirst();
|
stringEndLower = crcPair.getFirst();
|
||||||
stringCrc = crcPair.getSecond();
|
stringCrc = crcPair.getSecond();
|
||||||
|
// Calculate the crc value with case-insensitive
|
||||||
|
Pair<String, Long> crcPairWithCaseInSensitive = CrcHelper.getStringCrcPair(value, 16, false, false);
|
||||||
|
stringLower = crcPairWithCaseInSensitive.getFirst();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getId()
|
public Long getId()
|
||||||
@@ -156,4 +160,14 @@ public class PropertyStringValueEntity
|
|||||||
{
|
{
|
||||||
this.stringCrc = stringCrc;
|
this.stringCrc = stringCrc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getStringLower()
|
||||||
|
{
|
||||||
|
return stringLower;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStringLower(String stringLower)
|
||||||
|
{
|
||||||
|
this.stringLower = stringLower;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -2,7 +2,7 @@
|
|||||||
* #%L
|
* #%L
|
||||||
* Alfresco Repository
|
* Alfresco Repository
|
||||||
* %%
|
* %%
|
||||||
* Copyright (C) 2005 - 2016 Alfresco Software Limited
|
* Copyright (C) 2005 - 2024 Alfresco Software Limited
|
||||||
* %%
|
* %%
|
||||||
* This file is part of the Alfresco software.
|
* This file is part of the Alfresco software.
|
||||||
* If the software was purchased under a paid Alfresco license, the terms of
|
* If the software was purchased under a paid Alfresco license, the terms of
|
||||||
@@ -256,11 +256,10 @@ public interface AuditService
|
|||||||
/**
|
/**
|
||||||
* Issue an audit query to retrieve min / max audit record id for a given application and properties
|
* Issue an audit query to retrieve min / max audit record id for a given application and properties
|
||||||
*
|
*
|
||||||
* @param applicationName the name of the application
|
|
||||||
* @param parameters audit parameters provided by the <code>where</code> clause on the ReST API
|
* @param parameters audit parameters provided by the <code>where</code> clause on the ReST API
|
||||||
* @return a map containing min/max and the associated value
|
* @return a map containing min/max and the associated value
|
||||||
*/
|
*/
|
||||||
default int getAuditEntriesCountByAppAndProperties(String applicationName, AuditQueryParameters parameters)
|
default int getAuditEntriesCountByAppAndProperties(AuditQueryParameters parameters)
|
||||||
{
|
{
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user