Skip to content

[#1143] Table Data Should Be Sorted Chronologically By Default#1144

Merged
ThatSilentCoder merged 4 commits intomainfrom
v3.1_issue_1143-have-table-data-be-sorted-chronologically-out-of-the-box
Mar 19, 2026
Merged

[#1143] Table Data Should Be Sorted Chronologically By Default#1144
ThatSilentCoder merged 4 commits intomainfrom
v3.1_issue_1143-have-table-data-be-sorted-chronologically-out-of-the-box

Conversation

@ThatSilentCoder
Copy link
Collaborator

@ThatSilentCoder ThatSilentCoder commented Mar 18, 2026

Description

Pages with table data will now have their entries sorted by creation time by default.


Test Instructions:

  1. Run the ACA using your preferred method.
  2. Upload multiple certificates and RIMs to their respective pages.
  3. Run the Provisioner against the ACA and verify that the ACA displays each page's data in order of their creation time (most recent upload first, oldest upload last).

Summary Of Changes:

  1. In the Page Service and Page Controller classes, the keyword this., unless it is being used in the constructor, has been removed for cleaner, more readable code.
  2. In the HelperPageService class, the variable logFilesPath will no longer be injected via field but via Constructor. This change was made to make the injected dependency explicit, immutable, and easier to test.
  3. Moved @Log4j2 annotation below Spring Boot @Service and @Controller annotations to follow standard annotation conventions.
  4. Added a line to the ControllerPagesUtils file that orders all data entries by Create Time by default if the user didn't sort the page by any of the table columns.
  5. Replaced the List<> findByArchiveFlag() methods in the repository classes with long countByArchiveFlag() since the original method was being used, in most cases, to retrieve the list of entries only to determine the total count. The new method performs a direct count query, improving performance and reducing memory usage.
  6. Removed unused Repository methods in the Repository classes that were affected by this PR.

Issues This PR Addresses:

Closes #1143

…e list of certs/rims first and called the count/size method on that list to get the number of items in the db with the more efficient method. All pages will have their certs/rims be sorted in order they were created out-of-the-box. This can be clearly seen in the trust chain cert page and validation summary page (prior to this, these pages were not sorted by create time). PR ready.
@ThatSilentCoder ThatSilentCoder added enhancement Improving on an implemented feature v3.2.0 Issues for Release 3.2.0 of the ACA labels Mar 18, 2026
@ThatSilentCoder ThatSilentCoder linked an issue Mar 18, 2026 that may be closed by this pull request
* @return a list of certificate authority credentials
* @return a count of certificate authority credentials
*/
List<CertificateAuthorityCredential> findByArchiveFlag(boolean archiveFlag);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method was originally used to retrieve all entries from the repository and then count them using .size(). Since its only purpose was to get the total number of entries, it was replaced with countBy…, which performs a direct count query in the database, making it more efficient.

* @return a list of endorsement credentials
* @return a count of endorsement credentials
*/
List<EndorsementCredential> findByArchiveFlag(boolean archiveFlag);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method was originally used to retrieve all entries from the repository and then count them using .size(). Since its only purpose was to get the total number of entries, it was replaced with countBy…, which performs a direct count query in the database, making it more efficient.

* @return a list of IDevId certificates
* @return a count of idevid certificates
*/
List<IDevIDCertificate> findByArchiveFlag(boolean archiveFlag);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method was originally used to retrieve all entries from the repository and then count them using .size(). Since its only purpose was to get the total number of entries, it was replaced with countBy…, which performs a direct count query in the database, making it more efficient.

* @return a list of issued attestation certificates
* @return a count of issued certificates
*/
List<IssuedAttestationCertificate> findByArchiveFlag(boolean archiveFlag);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method was originally used to retrieve all entries from the repository and then count them using .size(). Since its only purpose was to get the total number of entries, it was replaced with countBy…, which performs a direct count query in the database, making it more efficient.



// /**
// * Query that retrieves a list of IDevId certificates using the provided subject.
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed unused repository methods.


if (isBaseRim) {
final BaseReferenceManifest baseReferenceManifest =
this.referenceManifestPageService.parseBaseRIM(errorMessages, file);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed unnecessary this. references from fields for cleaner, more readable code across the entire class.

}

rimFilteredRecordsList.setRecordsFiltered(pagedResult.getTotalElements());
rimFilteredRecordsList.setRecordsTotal(this.referenceManifestPageService.findRIMRepositoryCount());
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed unnecessary this. references from fields for cleaner, more readable code across the entire class.

for (ReferenceDigestValue rdv : rdvFilteredRecordsList) {
// We are updating the base rim ID field if necessary and
if (rdv.getBaseRimId() == null
&& this.referenceDigestValuePageService.doesRIMExist(rdv.getSupportRimId())) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed unnecessary this. references from fields for cleaner, more readable code across the entire class.


// add object that contains the leaf ACA certificate information
mav.addObject(LEAF_ACA_CERT_DATA, new HashMap<>(CertificateStringMapBuilder.getCertificateAuthorityInfoHelper(
this.certificateRepository,
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed unnecessary this. references from fields for cleaner, more readable code across the entire class.

final HttpServletResponse response)
throws IOException {
log.info("Received request to download validation summary reports");
this.validationSummaryPageService.downloadValidationReports(request, response);
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed unnecessary this. references from fields for cleaner, more readable code across the entire class.

…ils will now be responsible for setting the default sort column name so that all pages will be sorted by create time automatically. Sorting by column with no searches should work now.

// Create the Pageable object without sorting if no order column is provided
return PageRequest.of(currentPage, pageSize);
final String defaultSortColumnName = "createTime";
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here is where the default sorting column is set.

//Set data tables
let dataTable = setDataTables(viewName, "#reportTable", url, columns);

dataTable.order([1, "desc"]).draw(); //order by createTime
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line was causing issues with the default sorting set in the backend.

@ThatSilentCoder ThatSilentCoder merged commit 4a3be87 into main Mar 19, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improving on an implemented feature v3.2.0 Issues for Release 3.2.0 of the ACA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Table Data Should Be Sorted Chronologically Out Of The Box

2 participants