fix for the apps-3129

This commit is contained in:
Sathish Kumar
2024-12-12 09:08:17 +05:30
parent 4b549bf474
commit 131f6e67da
10 changed files with 2574 additions and 2588 deletions

View File

@@ -93,15 +93,15 @@ public class RMv33HoldAuditEntryValuesPatchUnitTest
verify(mockedRecordsManagementQueryDAO, times(1)).updatePropertyStringValueEntity(deleteHoldPropertyStringValueEntity);
assertEquals("Add To Hold", addToHoldPropertyStringValueEntity.getStringValue());
assertEquals("add to hold", addToHoldPropertyStringValueEntity.getStringLower());
assertEquals("add to hold", addToHoldPropertyStringValueEntity.getStringEndLower());
assertEquals(Long.valueOf(770_786_109L), addToHoldPropertyStringValueEntity.getStringCrc());
assertEquals("Remove From Hold", removeFromHoldPropertyStringValueEntity.getStringValue());
assertEquals("remove from hold", removeFromHoldPropertyStringValueEntity.getStringLower());
assertEquals("Remove From Hold", removeFromHoldPropertyStringValueEntity.getStrRvingValue());
assertEquals("remove from hold", removeFromHoldPropertyStringValueEntity.getStringEndLower());
assertEquals(Long.valueOf(2_967_613_012L), removeFromHoldPropertyStringValueEntity.getStringCrc());
assertEquals("Delete Hold", deleteHoldPropertyStringValueEntity.getStringValue());
assertEquals("delete hold", deleteHoldPropertyStringValueEntity.getStringLower());
assertEquals("delete hold", deleteHoldPropertyStringValueEntity.getStringEndLower());
assertEquals(Long.valueOf(132_640_810L), deleteHoldPropertyStringValueEntity.getStringCrc());
}
@@ -123,5 +123,3 @@ public class RMv33HoldAuditEntryValuesPatchUnitTest
verify(mockedRecordsManagementQueryDAO, times(0)).updatePropertyStringValueEntity(any());
}
}

View File

@@ -909,14 +909,15 @@ public class AuditImpl implements Audit
public int getAuditEntriesCountByAppAndProperties(AuditService.AuditApplication auditApplication, AuditEntryQueryWalker propertyWalker)
{
final String applicationName = auditApplication.getKey().substring(1);
AuditQueryParameters parameters = new AuditQueryParameters();
parameters.setApplicationName(auditApplication.getName());
parameters.setApplicationName(applicationName);
parameters.setFromTime(propertyWalker.getFromTime());
parameters.setToTime(propertyWalker.getToTime());
parameters.setFromId(propertyWalker.getFromId());
parameters.setToId(propertyWalker.getToId());
parameters.setUser(propertyWalker.getCreatedByUser());
return auditService.getAuditEntriesCountByAppAndProperties(parameters);
return auditService.getAuditEntriesCountByAppAndProperties(applicationName, parameters);
}
}

View File

@@ -276,10 +276,11 @@ public interface AuditComponent
/**
* 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
* @return a map containing min/max and the associated value
*/
default int getAuditEntriesCountByAppAndProperties(AuditQueryParameters parameters)
default int getAuditEntriesCountByAppAndProperties(String applicationName, AuditQueryParameters parameters)
{
return -1;
}

View File

@@ -946,7 +946,7 @@ public class AuditComponentImpl implements AuditComponent
public int getAuditEntriesCountByApp(String applicationName)
{
// Get the id for the application
AuditApplication app = auditModelRegistry.getAuditApplicationByName(applicationName);
AuditApplication app = auditModelRegistry.getAuditApplicationByKey(applicationName);
Long applicationId = app.getApplicationId();
if (applicationId == null)
{
@@ -956,8 +956,8 @@ public class AuditComponentImpl implements AuditComponent
return auditDAO.getAuditEntriesCountByApp(applicationId);
}
@Override public int getAuditEntriesCountByAppAndProperties(AuditQueryParameters parameters)
@Override public int getAuditEntriesCountByAppAndProperties(String applicationName, AuditQueryParameters parameters)
{
return auditDAO.getAuditEntriesCountByAppAndProperties(parameters);
return auditDAO.getAuditEntriesCountByAppAndProperties(applicationName, parameters);
}
}

View File

@@ -190,8 +190,8 @@ public class AuditServiceImpl implements AuditService
/**
* {@inheritDoc}
*/
@Override public int getAuditEntriesCountByAppAndProperties(AuditQueryParameters parameters)
@Override public int getAuditEntriesCountByAppAndProperties(String applicationName, AuditQueryParameters parameters)
{
return auditComponent.getAuditEntriesCountByAppAndProperties(parameters);
return auditComponent.getAuditEntriesCountByAppAndProperties(applicationName, parameters);
}
}

View File

@@ -102,21 +102,20 @@ public class CrcHelper
{
throw new RuntimeException("UTF-8 encoding is not supported");
}
// Crc Value will change based on the case-sensitive, So we need to get the short value based on case-sensitive
// Get the short value (case-sensitive or not)
String valueShort = null;
String currentValue = caseSensitive ? value : valueLowerCase;
int valueLen = currentValue.length();
int valueLen = valueLowerCase.length();
if (valueLen < dataLength)
{
valueShort = currentValue;
valueShort = valueLowerCase;
}
else if (useCharsFromStart)
{
valueShort = currentValue.substring(0, dataLength - 1);
valueShort = valueLowerCase.substring(0, dataLength - 1);
}
else
{
valueShort = currentValue.substring(valueLen - dataLength);
valueShort = valueLowerCase.substring(valueLen - dataLength);
}
return new Pair<String, Long>(valueShort, valueCrc);
}

View File

@@ -248,10 +248,11 @@ public interface AuditDAO
/**
* 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
* @return a map containing min/max and the associated value
*/
default int getAuditEntriesCountByAppAndProperties(org.alfresco.service.cmr.audit.AuditQueryParameters parameters)
default int getAuditEntriesCountByAppAndProperties(String applicationName, org.alfresco.service.cmr.audit.AuditQueryParameters parameters)
{
return -1;
}

View File

@@ -237,7 +237,7 @@ public class AuditDAOImpl extends AbstractAuditDAOImpl
}
@Override
public int getAuditEntriesCountByAppAndProperties(org.alfresco.service.cmr.audit.AuditQueryParameters parameters)
public int getAuditEntriesCountByAppAndProperties(String applicationName, org.alfresco.service.cmr.audit.AuditQueryParameters parameters)
{
AuditQueryParameters dbParameters = convertFromRestAuditQueryParameters(parameters);
@@ -313,4 +313,3 @@ public class AuditDAOImpl extends AbstractAuditDAOImpl
}
}
}

View File

@@ -44,7 +44,6 @@ public class PropertyStringValueEntity
private String stringValue;
private String stringEndLower;
private Long stringCrc;
private String stringLower;
public PropertyStringValueEntity()
{
@@ -116,9 +115,6 @@ public class PropertyStringValueEntity
Pair<String, Long> crcPair = CrcHelper.getStringCrcPair(value, 16, false, true);
stringEndLower = crcPair.getFirst();
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()
@@ -160,14 +156,4 @@ public class PropertyStringValueEntity
{
this.stringCrc = stringCrc;
}
public String getStringLower()
{
return stringLower;
}
public void setStringLower(String stringLower)
{
this.stringLower = stringLower;
}
}

View File

@@ -256,10 +256,11 @@ public interface AuditService
/**
* 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
* @return a map containing min/max and the associated value
*/
default int getAuditEntriesCountByAppAndProperties(AuditQueryParameters parameters)
default int getAuditEntriesCountByAppAndProperties(String applicationName, AuditQueryParameters parameters)
{
return -1;
}