diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/CACredentialRepository.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/CACredentialRepository.java
index 1319399e0..cd65b0e97 100644
--- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/CACredentialRepository.java
+++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/CACredentialRepository.java
@@ -9,79 +9,88 @@
import java.util.List;
import java.util.UUID;
+/**
+ * Repository interface for managing {@link CertificateAuthorityCredential} entities in the database.
+ *
+ *
+ * The {@link CACredentialRepository} interface extends {@link JpaRepository} to provide basic CRUD operations,
+ * including save, find, delete, and query methods. Custom query methods can be defined
+ * using Spring Data JPA's query method naming conventions or with the Query annotation.
+ *
+ */
@Repository
public interface CACredentialRepository extends JpaRepository {
/**
- * Query that retrieves a list of certificate authority credentials using the provided archive flag.
+ * Query that retrieves a count of {@link CertificateAuthorityCredential} objects in the database filtered by the provided
+ * archive flag.
*
* @param archiveFlag archive flag
- * @return a list of certificate authority credentials
+ * @return a count of {@link CertificateAuthorityCredential} objects
*/
- List findByArchiveFlag(boolean archiveFlag);
+ long countByArchiveFlag(boolean archiveFlag);
/**
- * Query that retrieves a page of certificate authority credentials using the provided archive
- * flag and the provided pageable.
+ * Query that retrieves a page of {@link CertificateAuthorityCredential} objects filtered by the specified archive flag.
*
* @param archiveFlag archive flag
* @param pageable pageable
- * @return a page of certificate authority credentials
+ * @return a page of {@link CertificateAuthorityCredential} objects
*/
Page findByArchiveFlag(boolean archiveFlag, Pageable pageable);
/**
- * Query that retrieves a list of certificate authority credentials using the provided subject.
+ * Query that retrieves a list of {@link CertificateAuthorityCredential} objects using the provided subject.
*
* @param subject subject
- * @return a list of certificate authority credentials
+ * @return a list of {@link CertificateAuthorityCredential} objects
*/
List findBySubject(String subject);
/**
- * Query that retrieves a sorted list of certificate authority credentials using the provided subject.
+ * Query that retrieves a sorted list of {@link CertificateAuthorityCredential} objects using the provided subject.
*
* @param subject subject
- * @return a sorted list of certificate authority credentials
+ * @return a sorted list of {@link CertificateAuthorityCredential} objects
*/
List findBySubjectSorted(String subject);
/**
- * Query that retrieves a list of certificate authority credentials using the provided subject
+ * Query that retrieves a list of {@link CertificateAuthorityCredential} objects using the provided subject
* and the provided archive flag.
*
* @param subject subject
* @param archiveFlag archive flag
- * @return a list of certificate authority credentials
+ * @return a list of {@link CertificateAuthorityCredential} objects
*/
List findBySubjectAndArchiveFlag(String subject, boolean archiveFlag);
/**
- * Query that retrieves a sorted list of certificate authority credentials using the provided subject
+ * Query that retrieves a sorted list of {@link CertificateAuthorityCredential} objects using the provided subject
* and the provided archive flag.
*
* @param subject subject
* @param archiveFlag archive flag
- * @return a sorted list of certificate authority credentials
+ * @return a sorted list of {@link CertificateAuthorityCredential} objects
*/
List findBySubjectSortedAndArchiveFlag(String subject,
boolean archiveFlag);
/**
- * Query that retrieves a certificate authority credential using the provided subject key identifier.
+ * Query that retrieves a {@link CertificateAuthorityCredential} object using the provided subject key identifier.
*
* @param subjectKeyIdentifier byte array representation of the subject key identifier
- * @return a certificate authority credential
+ * @return a {@link CertificateAuthorityCredential} object
*/
CertificateAuthorityCredential findBySubjectKeyIdentifier(byte[] subjectKeyIdentifier);
/**
- * Query that retrieves a certificate authority credential using the provided subject key identifier
+ * Query that retrieves a {@link CertificateAuthorityCredential} object using the provided subject key identifier
* and the provided archive flag.
*
* @param subjectKeyIdString string representation of the subject key id
* @param archiveFlag archive flag
- * @return a certificate authority credential
+ * @return a {@link CertificateAuthorityCredential} object
*/
CertificateAuthorityCredential findBySubjectKeyIdStringAndArchiveFlag(String subjectKeyIdString,
boolean archiveFlag);
diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/EndorsementCredentialRepository.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/EndorsementCredentialRepository.java
index dbf09fdf7..9328cbdaf 100644
--- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/EndorsementCredentialRepository.java
+++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/EndorsementCredentialRepository.java
@@ -10,47 +10,49 @@
import java.util.List;
import java.util.UUID;
+/**
+ * Repository interface for managing {@link EndorsementCredential} entities in the database.
+ *
+ *
+ * The {@link EndorsementCredentialRepository} interface extends {@link JpaRepository} to provide basic CRUD operations,
+ * including save, find, delete, and query methods. Custom query methods can be defined
+ * using Spring Data JPA's query method naming conventions or with the Query annotation.
+ *
+ */
@Repository
public interface EndorsementCredentialRepository extends JpaRepository {
/**
- * Query that retrieves a list of endorsement credentials using the provided archive flag.
+ * Query that retrieves a count of {@link EndorsementCredential} objects in the database filtered by the
+ * provided archive flag.
*
* @param archiveFlag archive flag
- * @return a list of endorsement credentials
+ * @return a count of {@link EndorsementCredential} objects
*/
- List findByArchiveFlag(boolean archiveFlag);
+ long countByArchiveFlag(boolean archiveFlag);
/**
- * Query that retrieves a page of endorsement credentials using provided archive flag and pageable value.
+ * Query that retrieves a page of {@link EndorsementCredential} objects filtered by the specified archive flag.
*
* @param archiveFlag archive flag
* @param pageable pageable value
- * @return a page of endorsement credentials
+ * @return a page of {@link EndorsementCredential} objects
*/
Page findByArchiveFlag(boolean archiveFlag, Pageable pageable);
/**
- * Query that retrieves an endorsement credential using the provided holder serial number.
- *
- * @param holderSerialNumber big integer representation of the holder serial number
- * @return an endorsement credential
- */
- EndorsementCredential findByHolderSerialNumber(BigInteger holderSerialNumber);
-
- /**
- * Query that retrieves an endorsement credential using the provided serial number.
+ * Query that retrieves an {@link EndorsementCredential} object using the provided serial number.
*
* @param serialNumber big integer representation of the serial number
- * @return an endorsement credential
+ * @return an {@link EndorsementCredential} object
*/
EndorsementCredential findBySerialNumber(BigInteger serialNumber);
/**
- * Query that retrieves a list of endorsement credentials using the provided device id.
+ * Query that retrieves a list of {@link EndorsementCredential} objects using the provided device id.
*
* @param deviceId uuid representation of the device id
- * @return an endorsement credential
+ * @return a list of {@link EndorsementCredential} objects
*/
List findByDeviceId(UUID deviceId);
}
diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/IDevIDCertificateRepository.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/IDevIDCertificateRepository.java
index b8d062a09..cbe22df5b 100644
--- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/IDevIDCertificateRepository.java
+++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/IDevIDCertificateRepository.java
@@ -6,80 +6,34 @@
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
-import java.util.List;
import java.util.UUID;
+/**
+ * Repository interface for managing {@link IDevIDCertificate} entities in the database.
+ *
+ *
+ * The {@link IDevIDCertificateRepository} interface extends {@link JpaRepository} to provide basic CRUD operations,
+ * including save, find, delete, and query methods. Custom query methods can be defined
+ * using Spring Data JPA's query method naming conventions or with the Query annotation.
+ *
+ */
@Repository
public interface IDevIDCertificateRepository extends JpaRepository {
/**
- * Query that retrieves a list of IDevId certificates using the provided archive flag.
+ * Query that retrieves a count of {@link IDevIDCertificate} objects in the database filtered by the provided archive flag.
*
* @param archiveFlag archive flag
- * @return a list of IDevId certificates
+ * @return a count of {@link IDevIDCertificate} objects
*/
- List findByArchiveFlag(boolean archiveFlag);
+ long countByArchiveFlag(boolean archiveFlag);
/**
- * Query that retrieves a page of IDevId certificates using the provided archive flag and pageable value.
+ * Query that retrieves a page of {@link IDevIDCertificate} objects filtered by the specified archive flag.
*
* @param archiveFlag archive flag
* @param pageable pageable value
- * @return a page of IDevId certificates
+ * @return a page of {@link IDevIDCertificate} objects
*/
Page findByArchiveFlag(boolean archiveFlag, Pageable pageable);
-
-
- // /**
-// * Query that retrieves a list of IDevId certificates using the provided subject.
-// *
-// * @param subject string representation of the subject
-// * @return a list of IDevId certificates
-// */
-// List findBySubject(String subject);
-//
-// /**
-// * Query that retrieves a sorted list of IDevId certificates using the provided subject.
-// *
-// * @param subject string representation of the subject
-// * @return a sorted list of IDevId certificates
-// */
-// List findBySubjectSorted(String subject);
-//
-// /**
-// * Query that retrieves a list of IDevId certificates using the provided subject and archive flag.
-// *
-// * @param subject string representation of the subject
-// * @param archiveFlag archive flag
-// * @return a list of IDevId certificates
-// */
-// List findBySubjectAndArchiveFlag(String subject, boolean archiveFlag);
-//
-// /**
-// * Query that retrieves a sorted list of IDevId certificates using the provided subject
-// * and archive flag.
-// *
-// * @param subject string representation of the subject
-// * @param archiveFlag archive flag
-// * @return a sorted list of IDevId certificates
-// */
-// List findBySubjectSortedAndArchiveFlag(String subject, boolean archiveFlag);
-//
-// /**
-// * Query that retrieves an IDevId certificate using the provided subject key identifier.
-// *
-// * @param subjectKeyIdentifier byte representation of the subject key identifier
-// * @return an IDevId certificate
-// */
-// IDevIDCertificate findBySubjectKeyIdentifier(byte[] subjectKeyIdentifier);
-//
-// /**
-// * Query that retrieves an IDevId certificate using the provided subject key and archive flag.
-// *
-// * @param subjectKeyIdString string representation of the subject key id
-// * @param archiveFlag archive flag
-// * @return an IDevId certificate
-// */
-// IDevIDCertificate findBySubjectKeyIdStringAndArchiveFlag(String subjectKeyIdString,
-// boolean archiveFlag);
}
diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/IssuedCertificateRepository.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/IssuedCertificateRepository.java
index 0d50494f8..b5fc8f2b5 100644
--- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/IssuedCertificateRepository.java
+++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/IssuedCertificateRepository.java
@@ -9,32 +9,41 @@
import java.util.List;
import java.util.UUID;
+/**
+ * Repository interface for managing {@link IssuedAttestationCertificate} entities in the database.
+ *
+ *
+ * The {@link IssuedCertificateRepository} interface extends {@link JpaRepository} to provide basic CRUD operations,
+ * including save, find, delete, and query methods. Custom query methods can be defined
+ * using Spring Data JPA's query method naming conventions or with the Query annotation.
+ *
+ */
@Repository
public interface IssuedCertificateRepository extends JpaRepository {
/**
- * Query that retrieves a list of issued attestation certificates using the provided archive flag.
+ * Query that retrieves a count of {@link IssuedAttestationCertificate} objects in the database filtered by the provided archive flag.
*
* @param archiveFlag archive flag
- * @return a list of issued attestation certificates
+ * @return a count of {@link IssuedAttestationCertificate} objects
*/
- List findByArchiveFlag(boolean archiveFlag);
+ long countByArchiveFlag(boolean archiveFlag);
/**
- * Query that retrieves a page of issued attestation certificates using the provided archive flag
+ * Query that retrieves a page of {@link IssuedAttestationCertificate} objects using the provided archive flag
* and pageable value.
*
* @param archiveFlag archive flag
* @param pageable pageable value
- * @return a page of issued attestation certificates
+ * @return a page of {@link IssuedAttestationCertificate} objects
*/
Page findByArchiveFlag(boolean archiveFlag, Pageable pageable);
/**
- * Query that retrieves a list of issued attestation certificates using the provided device id.
+ * Query that retrieves a list of {@link IssuedAttestationCertificate} objects using the provided device id.
*
* @param deviceId uuid representation of the device id
- * @return a list of issued attestation certificates
+ * @return a list of {@link IssuedAttestationCertificate} objects
*/
List findByDeviceId(UUID deviceId);
}
diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/PlatformCertificateRepository.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/PlatformCertificateRepository.java
index ad7a41905..e41094389 100644
--- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/PlatformCertificateRepository.java
+++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/PlatformCertificateRepository.java
@@ -9,32 +9,40 @@
import java.util.List;
import java.util.UUID;
+/**
+ * Repository interface for managing {@link PlatformCredential} entities in the database.
+ *
+ *
+ * The {@link PlatformCertificateRepository} interface extends {@link JpaRepository} to provide basic CRUD operations,
+ * including save, find, delete, and query methods. Custom query methods can be defined
+ * using Spring Data JPA's query method naming conventions or with the Query annotation.
+ *
+ */
@Repository
public interface PlatformCertificateRepository extends JpaRepository {
/**
- * Query that retrieves a list of platform credentials using the provided archive flag.
+ * Query that retrieves a count of {@link PlatformCredential} objects in the database filtered by the provided archive flag.
*
* @param archiveFlag archive flag
- * @return a list of platform credentials
+ * @return a count of {@link PlatformCredential} objects
*/
- List findByArchiveFlag(boolean archiveFlag);
+ long countByArchiveFlag(boolean archiveFlag);
/**
- * Query that retrieves a page of platform credentials using the provided archive flag
- * and pageable value.
+ * Query that retrieves a page of {@link PlatformCredential} objects filtered by the specified archive flag.
*
* @param archiveFlag archive flag
* @param pageable pageable
- * @return a page of platform credentials
+ * @return a page of {@link PlatformCredential} objects
*/
Page findByArchiveFlag(boolean archiveFlag, Pageable pageable);
/**
- * Query that retrieves a list of platform credentials using the provided device id.
+ * Query that retrieves a list of {@link PlatformCredential} objects using the provided device id.
*
* @param deviceId uuid representation of the device id
- * @return a list of platform credentials
+ * @return a list of {@link PlatformCredential} objects
*/
List findByDeviceId(UUID deviceId);
}
diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/ReferenceManifestRepository.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/ReferenceManifestRepository.java
index 984ea0e32..f66e88ccf 100644
--- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/ReferenceManifestRepository.java
+++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/ReferenceManifestRepository.java
@@ -13,71 +13,80 @@
import java.util.List;
import java.util.UUID;
+/**
+ * Repository interface for managing {@link ReferenceManifest} entities in the database.
+ *
+ *
+ * The {@link ReferenceManifestRepository} interface extends {@link JpaRepository} to provide basic CRUD operations,
+ * including save, find, delete, and query methods. Custom query methods can be defined
+ * using Spring Data JPA's query method naming conventions or with the Query annotation.
+ *
+ */
@Repository
public interface ReferenceManifestRepository extends JpaRepository {
/**
- * Query that retrieves a reference manifest using the provided hex/dec hash.
+ * Query that retrieves a {@link ReferenceManifest} object using the provided hex/dec hash.
*
* @param hexDecHash string representation of the hex dec hash
- * @return a reference manifest
+ * @return a {@link ReferenceManifest} object
*/
ReferenceManifest findByHexDecHash(String hexDecHash);
/**
- * Query that retrieves a reference manifest using the provided base 64 hash.
+ * Query that retrieves a {@link ReferenceManifest} object using the provided base 64 hash.
*
* @param base64Hash string representation of the base 64 hash
- * @return a reference manifest
+ * @return a {@link ReferenceManifest} object
*/
ReferenceManifest findByBase64Hash(String base64Hash);
/**
- * Query that retrieves a reference manifest using the provided hex/dec hash and rim type.
+ * Query that retrieves a {@link ReferenceManifest} object using the provided hex/dec hash and rim type.
*
* @param hexDecHash string representation of the hex dec hash
* @param rimType string representation of the rim type
- * @return a reference manifest
+ * @return a {@link ReferenceManifest} object
*/
ReferenceManifest findByHexDecHashAndRimType(String hexDecHash, String rimType);
/**
- * Query that retrieves an unarchived reference manifest using the provided hex/dec hash and rim type.
+ * Query that retrieves an unarchived {@link ReferenceManifest} object using the provided hex/dec hash and rim type.
*
* @param hexDecHash string representation of the hex dec hash
* @param rimType string representation of the rim type
- * @return a reference manifest
+ * @return a {@link ReferenceManifest} object
*/
@Query(value = "SELECT * FROM ReferenceManifest WHERE hexDecHash = ?1 AND rimType = ?2 "
+ "AND archiveFlag is false", nativeQuery = true)
ReferenceManifest findByHexDecHashAndRimTypeUnarchived(String hexDecHash, String rimType);
/**
- * Query that retrieves a reference manifest using the provided event log hash and rim type.
+ * Query that retrieves a {@link ReferenceManifest} object using the provided event log hash and rim type.
*
* @param hexDecHash string representation of the event log hash
* @param rimType string representation of the rim type
- * @return a reference manifest
+ * @return a {@link ReferenceManifest} object
*/
ReferenceManifest findByEventLogHashAndRimType(String hexDecHash, String rimType);
/**
- * Query that retrieves a list of base reference manifests using the provided manufacturer and model
+ * Query that retrieves a list of {@link BaseReferenceManifest} objects using the provided manufacturer and model
* and where the rim type is equal to base.
*
* @param manufacturer string representation of platform manufacturer
* @param model string representation of platform model
- * @return a list of base reference manifests
+ * @return a list of {@link BaseReferenceManifest} objects
*/
@Query(value = "SELECT * FROM ReferenceManifest WHERE platformManufacturer = ?1 AND platformModel = ?2 "
+ "AND rimType = 'Base'", nativeQuery = true)
List getBaseByManufacturerModel(String manufacturer, String model);
/**
- * Query that retrieves a list of base reference manifests using the provided manufacturer and model.
+ * Query that retrieves a list of {@link BaseReferenceManifest} objects using the provided manufacturer and model.
*
* @param manufacturer string representation of platform manufacturer
* @param dType dtype
- * @return a list of base reference manifests
+ * @return a list of {@link BaseReferenceManifest} objects
*/
@Query(value = "SELECT * FROM ReferenceManifest WHERE platformManufacturer = ?1 AND DTYPE = ?2",
nativeQuery = true)
@@ -95,19 +104,19 @@ public interface ReferenceManifestRepository extends JpaRepository findAllBaseRims();
/**
- * Query that retrieves a list of support reference manifests where the dtype is a
+ * Query that retrieves a list of {@link SupportReferenceManifest} objects where the dtype is a
* support reference manifest.
*
- * @return a list of support reference manifests
+ * @return a list of {@link SupportReferenceManifest} objects
*/
@Query(value = "SELECT * FROM ReferenceManifest WHERE DTYPE = 'SupportReferenceManifest'",
nativeQuery = true)
@@ -147,11 +156,11 @@ public interface ReferenceManifestRepository extends JpaRepository getSupportByManufacturerModel(String manufacturer, String model);
/**
- * Query that retrieves event log measurements using the provided platform model and where the dtype is
- * event log measurements.
+ * Query that retrieves an {@link EventLogMeasurements} object using the provided platform model and where the
+ * dtype is event log measurements.
*
* @param model string representation of platform model.
- * @return event log measurements
+ * @return an {@link EventLogMeasurements} object
*/
@Query(value = "SELECT * FROM ReferenceManifest WHERE platformModel = ?1 "
+ "AND DTYPE = 'EventLogMeasurements'", nativeQuery = true)
EventLogMeasurements getLogByModel(String model);
/**
- * Query that retrieves a list of reference manifests using the provided device name.
+ * Query that retrieves a list of {@link ReferenceManifest} objects using the provided device name.
*
* @param deviceName string representation of device name
- * @return a list of reference manifests
+ * @return a list of {@link ReferenceManifest} objects
*/
List findByDeviceName(String deviceName);
/**
- * Query that retrieves a list of reference manifests using the provided archive flag.
+ * Query that retrieves a list of {@link ReferenceManifest} objects using the provided archive flag.
*
* @param archiveFlag archive flag
- * @return a list of reference manifests
+ * @return a list of {@link ReferenceManifest} objects
*/
List findByArchiveFlag(boolean archiveFlag);
/**
- * Query that retrieves a page of reference manifests using the provided archive flag and pageable value.
+ * Query that retrieves a count of {@link ReferenceManifest} objects in the database filtered by the provided archive flag.
*
* @param archiveFlag archive flag
- * @param pageable pageable
- * @return a page of reference manifests
+ * @return a count of {@link ReferenceManifest} objects
*/
- Page findByArchiveFlag(boolean archiveFlag, Pageable pageable);
+ long countByArchiveFlag(boolean archiveFlag);
/**
- * Query that retrieves a page of base and support reference manifests and pageable value.
+ * Retrieves a paginated list of {@link ReferenceManifest} instances matching the specified subclass types.
+ *
+ * @param types the list of {@link ReferenceManifest} subclass types to include
* @param pageable pageable
- * @return a page of reference manifests
+ * @return a page of matching {@link ReferenceManifest} instances
*/
- @Query(value = "SELECT * FROM ReferenceManifest WHERE DTYPE IN "
- + "('BaseReferenceManifest', 'SupportReferenceManifest')", nativeQuery = true)
- Page findAllBaseAndSupportRimsPageable(Pageable pageable);
+ Page findByClassIn(List> types, Pageable pageable);
}
diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/SupplyChainValidationSummaryRepository.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/SupplyChainValidationSummaryRepository.java
index bf4964b3e..0181e060b 100644
--- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/SupplyChainValidationSummaryRepository.java
+++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/entity/manager/SupplyChainValidationSummaryRepository.java
@@ -1,40 +1,31 @@
package hirs.attestationca.persist.entity.manager;
-import hirs.attestationca.persist.entity.userdefined.Device;
import hirs.attestationca.persist.entity.userdefined.SupplyChainValidationSummary;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.stereotype.Repository;
-import java.util.List;
import java.util.UUID;
+/**
+ * Repository interface for managing {@link SupplyChainValidationSummary} entities in the database.
+ *
+ *
+ * The {@link SupplyChainValidationSummaryRepository} interface extends {@link JpaRepository} to provide
+ * basic CRUD operations, including save, find, delete, and query methods. Custom query methods can be defined
+ * using Spring Data JPA's query method naming conventions or with the Query annotation.
+ *
+ */
@Repository
-public interface SupplyChainValidationSummaryRepository
- extends JpaRepository {
+public interface SupplyChainValidationSummaryRepository extends JpaRepository {
/**
- * Query that retrieves a supply chain validation summary using the provided device.
- *
- * @param device device
- * @return a supply chain validation summary
- */
- SupplyChainValidationSummary findByDevice(Device device);
-
- /**
- * Query that retrieves a list of supply chain validation summaries where the archive flag is false.
- *
- * @return a list of supply chain validation summary
- */
- List findByArchiveFlagFalse();
-
- /**
- * Query that retrieves a page of supply chain validation summaries using the provided pageable value
+ * Query that retrieves a page of {@link SupplyChainValidationSummary} objects using the provided pageable value
* and where the archive flag is false.
*
* @param pageable pageable
- * @return a page of supply chain validation summary
+ * @return a page of {@link SupplyChainValidationSummary} objects
*/
Page findByArchiveFlagFalse(Pageable pageable);
}
diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/DevicePageService.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/DevicePageService.java
index 236878d20..959454da9 100644
--- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/DevicePageService.java
+++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/DevicePageService.java
@@ -35,7 +35,7 @@
import java.util.UUID;
/**
- * A service layer class responsible for encapsulating all business logic related to the Device Page.
+ * Service class responsible for encapsulating all business logic related to the Device Page.
*/
@Service
@Log4j2
@@ -206,7 +206,7 @@ public Page findDevicesByGlobalAndColumnSpecificSearchTerm(
* @return a page of all devices
*/
public Page findAllDevices(final Pageable pageable) {
- return this.deviceRepository.findAll(pageable);
+ return deviceRepository.findAll(pageable);
}
/**
@@ -215,7 +215,7 @@ public Page findAllDevices(final Pageable pageable) {
* @return total number of records in the device repository.
*/
public long findDeviceRepositoryCount() {
- return this.deviceRepository.count();
+ return deviceRepository.count();
}
/**
@@ -275,7 +275,7 @@ private void addPlatformCredentialEntryToDeviceMap(final Device device,
final HashMap> certificatePropertyMap) {
// find all platform certificates associated with this device id
final List platformCredentialList =
- this.platformCertificateRepository.findByDeviceId(device.getId());
+ platformCertificateRepository.findByDeviceId(device.getId());
final String platformCredentialIdsKey = PlatformCredential.class.getSimpleName() + "Ids";
@@ -300,7 +300,7 @@ private void addEndorsementCredentialEntryToDeviceMap(final Device device,
final HashMap> certificatePropertyMap) {
// find all endorsement certificates associated with this device id
final List endorsementCredentialList =
- this.endorsementCredentialRepository.findByDeviceId(device.getId());
+ endorsementCredentialRepository.findByDeviceId(device.getId());
final String endorsementCredentialIdsKey = EndorsementCredential.class.getSimpleName() + "Ids";
@@ -325,7 +325,7 @@ private void addIssuedCertificateEntryToDeviceMap(final Device device,
final HashMap> certificatePropertyMap) {
// find all issued certificates associated with this device id
final List issuedCertificateList =
- this.issuedCertificateRepository.findByDeviceId(device.getId());
+ issuedCertificateRepository.findByDeviceId(device.getId());
final String issuedCertificatesIdsKey = IssuedAttestationCertificate.class.getSimpleName() + "Ids";
diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/EndorsementCredentialPageService.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/EndorsementCredentialPageService.java
index ef597a3ae..5c7eb4d1b 100644
--- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/EndorsementCredentialPageService.java
+++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/EndorsementCredentialPageService.java
@@ -14,11 +14,10 @@
import java.util.List;
/**
- * A service layer class responsible for encapsulating all business logic related to the Endorsement
- * Credentials Page.
+ * Service class responsible for encapsulating all business logic related to the Endorsement Credentials Page.
*/
-@Log4j2
@Service
+@Log4j2
public class EndorsementCredentialPageService {
private final EndorsementCredentialRepository endorsementCredentialRepository;
@@ -28,8 +27,7 @@ public class EndorsementCredentialPageService {
* @param endorsementCredentialRepository endorsement credential repository
*/
@Autowired
- public EndorsementCredentialPageService(
- final EndorsementCredentialRepository endorsementCredentialRepository) {
+ public EndorsementCredentialPageService(final EndorsementCredentialRepository endorsementCredentialRepository) {
this.endorsementCredentialRepository = endorsementCredentialRepository;
}
@@ -42,7 +40,7 @@ public EndorsementCredentialPageService(
*/
public Page findEndorsementCredentialsByArchiveFlag(final boolean archiveFlag,
final Pageable pageable) {
- return this.endorsementCredentialRepository.findByArchiveFlag(archiveFlag, pageable);
+ return endorsementCredentialRepository.findByArchiveFlag(archiveFlag, pageable);
}
/**
@@ -51,7 +49,7 @@ public Page findEndorsementCredentialsByArchiveFlag(final
* @return total number of records in the endorsement credential repository.
*/
public long findEndorsementCredentialRepositoryCount() {
- return this.endorsementCredentialRepository.findByArchiveFlag(false).size();
+ return endorsementCredentialRepository.countByArchiveFlag(false);
}
/**
@@ -71,8 +69,8 @@ public EndorsementCredential parseEndorsementCredential(final MultipartFile file
try {
fileBytes = file.getBytes();
} catch (IOException ioEx) {
- final String failMessage = String.format(
- "Failed to read uploaded endorsement credential file (%s): ", fileName);
+ final String failMessage =
+ String.format("Failed to read uploaded endorsement credential file (%s): ", fileName);
log.error(failMessage, ioEx);
errorMessages.add(failMessage + ioEx.getMessage());
return null;
@@ -81,26 +79,25 @@ public EndorsementCredential parseEndorsementCredential(final MultipartFile file
try {
return new EndorsementCredential(fileBytes);
} catch (IOException ioEx) {
- final String failMessage = String.format(
- "Failed to parse uploaded endorsement credential file (%s): ", fileName);
+ final String failMessage =
+ String.format("Failed to parse uploaded endorsement credential file (%s): ", fileName);
log.error(failMessage, ioEx);
errorMessages.add(failMessage + ioEx.getMessage());
return null;
} catch (DecoderException dEx) {
- final String failMessage = String.format(
- "Failed to parse uploaded endorsement credential pem file (%s): ", fileName);
+ final String failMessage =
+ String.format("Failed to parse uploaded endorsement credential pem file (%s): ", fileName);
log.error(failMessage, dEx);
errorMessages.add(failMessage + dEx.getMessage());
return null;
} catch (IllegalArgumentException iaEx) {
- final String failMessage = String.format(
- "Endorsement credential format not recognized(%s): ", fileName);
+ final String failMessage = String.format("Endorsement credential format not recognized(%s): ", fileName);
log.error(failMessage, iaEx);
errorMessages.add(failMessage + iaEx.getMessage());
return null;
} catch (IllegalStateException isEx) {
- final String failMessage = String.format(
- "Unexpected object while parsing endorsement credential %s ", fileName);
+ final String failMessage =
+ String.format("Unexpected object while parsing endorsement credential %s ", fileName);
log.error(failMessage, isEx);
errorMessages.add(failMessage + isEx.getMessage());
return null;
diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/HelpPageService.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/HelpPageService.java
index ee0d2859a..8a1c4a9d6 100644
--- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/HelpPageService.java
+++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/HelpPageService.java
@@ -21,11 +21,10 @@
import java.util.zip.ZipOutputStream;
/**
- * Service layer component that handles HIRS application logging
- * and supports various Help page-related operations.
+ * Service class that handles HIRS application logging and supports various Help page-related operations.
*/
-@Log4j2
@Service
+@Log4j2
public class HelpPageService {
private static final String MAIN_HIRS_LOGGER_NAME = "hirs.attestationca";
@@ -33,16 +32,18 @@ public class HelpPageService {
private final LoggersEndpoint loggersEndpoint;
- @Value("${logging.file.path}")
- private String logFilesPath;
+ private final String logFilesPath;
/**
* Constructor for Help Page Service.
*
* @param loggersEndpoint loggers endpoint
+ * @param logFilesPath log files path
*/
- public HelpPageService(final LoggersEndpoint loggersEndpoint) {
+ public HelpPageService(final LoggersEndpoint loggersEndpoint,
+ @Value("${logging.file.path}") final String logFilesPath) {
this.loggersEndpoint = loggersEndpoint;
+ this.logFilesPath = logFilesPath;
}
/**
@@ -81,8 +82,7 @@ public void bulkDownloadHIRSLogFiles(final ZipOutputStream zipOut) throws IOExce
final String fileName = fileNamePath.toString();
// and is a HIRS Attestation CA log file
- if (fileName.startsWith(HIRS_ATTESTATION_CA_PORTAL_LOG_NAME)
- && fileName.endsWith(".log")) {
+ if (fileName.startsWith(HIRS_ATTESTATION_CA_PORTAL_LOG_NAME) && fileName.endsWith(".log")) {
// Create a new zip entry with the file's name
ZipEntry zipEntry = new ZipEntry(fileName);
zipEntry.setTime(System.currentTimeMillis());
@@ -108,8 +108,11 @@ public void bulkDownloadHIRSLogFiles(final ZipOutputStream zipOut) throws IOExce
*/
public HIRSLogger getMainHIRSLogger() {
// retrieve all the applications' loggers
- Map allLoggers =
- loggersEndpoint.loggers().getLoggers();
+ Map allLoggers = loggersEndpoint.loggers().getLoggers();
+
+ if (allLoggers == null) {
+ throw new IllegalArgumentException("There are no loggers present in the HIRS Application.");
+ }
// retrieve the ONE main HIRS Logger from the list of loggers
Optional> mainLoggerEntry =
@@ -124,19 +127,16 @@ public HIRSLogger getMainHIRSLogger() {
if (mainLoggerEntry.isPresent()) {
// grab the main HIRS logger's name and description
final String loggerName = mainLoggerEntry.get().getKey();
- final LoggersEndpoint.LoggerLevelsDescriptor loggerLevelsDescriptor =
- mainLoggerEntry.get().getValue();
+ final LoggersEndpoint.LoggerLevelsDescriptor loggerLevelsDescriptor = mainLoggerEntry.get().getValue();
// set the log level of the HIRS logger based on the configured level
LogLevel logLevel;
- // if the log level has already been configured, find the enum equivalent of that
- // configured log level
+ // if the log level has already been configured, find the enum equivalent of that configured log level
if (loggerLevelsDescriptor.getConfiguredLevel() != null) {
logLevel = LogLevel.valueOf(loggerLevelsDescriptor.getConfiguredLevel());
} else {
- // if the log level has not been configured (current configured log level is null),
- // set the log level to info
+ // if the log level has not been configured, set the log level to info
logLevel = LogLevel.INFO;
}
diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/IDevIdCertificatePageService.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/IDevIdCertificatePageService.java
index 8767014d3..2c1903f34 100644
--- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/IDevIdCertificatePageService.java
+++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/IDevIdCertificatePageService.java
@@ -14,11 +14,10 @@
import java.util.List;
/**
- * A service layer class responsible for encapsulating all business logic related to the IDevId Certificate
- * Page.
+ * Service class responsible for encapsulating all business logic related to the IDevId Certificate Page.
*/
-@Log4j2
@Service
+@Log4j2
public class IDevIdCertificatePageService {
private final IDevIDCertificateRepository iDevIDCertificateRepository;
@@ -41,7 +40,7 @@ public IDevIdCertificatePageService(final IDevIDCertificateRepository iDevIDCert
*/
public Page findIDevCertificatesByArchiveFlag(final boolean archiveFlag,
final Pageable pageable) {
- return this.iDevIDCertificateRepository.findByArchiveFlag(archiveFlag, pageable);
+ return iDevIDCertificateRepository.findByArchiveFlag(archiveFlag, pageable);
}
/**
@@ -50,7 +49,7 @@ public Page findIDevCertificatesByArchiveFlag(final boolean a
* @return total number of records in the idevid certificate repository.
*/
public long findIDevIdCertificateRepositoryCount() {
- return iDevIDCertificateRepository.findByArchiveFlag(false).size();
+ return iDevIDCertificateRepository.countByArchiveFlag(false);
}
/**
@@ -69,8 +68,8 @@ public IDevIDCertificate parseIDevIDCertificate(final MultipartFile file, final
try {
fileBytes = file.getBytes();
} catch (IOException ioEx) {
- final String failMessage = String.format(
- "Failed to read uploaded IDevId certificate file (%s): ", fileName);
+ final String failMessage =
+ String.format("Failed to read uploaded IDevId certificate file (%s): ", fileName);
log.error(failMessage, ioEx);
errorMessages.add(failMessage + ioEx.getMessage());
return null;
@@ -79,26 +78,25 @@ public IDevIDCertificate parseIDevIDCertificate(final MultipartFile file, final
try {
return new IDevIDCertificate(fileBytes);
} catch (IOException ioEx) {
- final String failMessage = String.format(
- "Failed to parse uploaded IDevId certificate file (%s): ", fileName);
+ final String failMessage =
+ String.format("Failed to parse uploaded IDevId certificate file (%s): ", fileName);
log.error(failMessage, ioEx);
errorMessages.add(failMessage + ioEx.getMessage());
return null;
} catch (DecoderException dEx) {
- final String failMessage = String.format(
- "Failed to parse uploaded IDevId certificate pem file (%s): ", fileName);
+ final String failMessage =
+ String.format("Failed to parse uploaded IDevId certificate pem file (%s): ", fileName);
log.error(failMessage, dEx);
errorMessages.add(failMessage + dEx.getMessage());
return null;
} catch (IllegalArgumentException iaEx) {
- final String failMessage = String.format(
- "IDevId certificate format not recognized(%s): ", fileName);
+ final String failMessage = String.format("IDevId certificate format not recognized(%s): ", fileName);
log.error(failMessage, iaEx);
errorMessages.add(failMessage + iaEx.getMessage());
return null;
} catch (IllegalStateException isEx) {
- final String failMessage = String.format(
- "Unexpected object while parsing IDevId certificate %s ", fileName);
+ final String failMessage =
+ String.format("Unexpected object while parsing IDevId certificate %s ", fileName);
log.error(failMessage, isEx);
errorMessages.add(failMessage + isEx.getMessage());
return null;
diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/IssuedAttestationCertificatePageService.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/IssuedAttestationCertificatePageService.java
index 55e0c4616..abfec91bc 100644
--- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/IssuedAttestationCertificatePageService.java
+++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/IssuedAttestationCertificatePageService.java
@@ -9,11 +9,11 @@
import org.springframework.stereotype.Service;
/**
- * A service layer class responsible for encapsulating all business logic related to the Issued Attestation
+ * Service class responsible for encapsulating all business logic related to the Issued Attestation
* Certificate Page.
*/
-@Log4j2
@Service
+@Log4j2
public class IssuedAttestationCertificatePageService {
private final IssuedCertificateRepository issuedCertificateRepository;
@@ -36,7 +36,7 @@ public IssuedAttestationCertificatePageService(final IssuedCertificateRepository
*/
public Page findIssuedCertificatesByArchiveFlag(final boolean archiveFlag,
final Pageable pageable) {
- return this.issuedCertificateRepository.findByArchiveFlag(archiveFlag, pageable);
+ return issuedCertificateRepository.findByArchiveFlag(archiveFlag, pageable);
}
/**
@@ -45,6 +45,6 @@ public Page findIssuedCertificatesByArchiveFlag(fi
* @return total number of records in the issued certificate repository.
*/
public long findIssuedCertificateRepoCount() {
- return this.issuedCertificateRepository.findByArchiveFlag(false).size();
+ return issuedCertificateRepository.countByArchiveFlag(false);
}
}
diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/PlatformCredentialPageService.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/PlatformCredentialPageService.java
index 349b24eb1..1174ab67f 100644
--- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/PlatformCredentialPageService.java
+++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/PlatformCredentialPageService.java
@@ -17,11 +17,11 @@
import java.util.List;
/**
- * A service layer class responsible for encapsulating all business logic related to the Platform Credential
+ * Service class responsible for encapsulating all business logic related to the Platform Credential
* Page.
*/
-@Log4j2
@Service
+@Log4j2
public class PlatformCredentialPageService {
private final PlatformCertificateRepository platformCertificateRepository;
private final EndorsementCredentialRepository endorsementCredentialRepository;
@@ -48,7 +48,7 @@ public PlatformCredentialPageService(final PlatformCertificateRepository platfor
*/
public Page findPlatformCredentialsByArchiveFlag(final boolean archiveFlag,
final Pageable pageable) {
- return this.platformCertificateRepository.findByArchiveFlag(archiveFlag, pageable);
+ return platformCertificateRepository.findByArchiveFlag(archiveFlag, pageable);
}
/**
@@ -58,7 +58,7 @@ public Page findPlatformCredentialsByArchiveFlag(final boole
* @return endorsement credential
*/
public EndorsementCredential findECBySerialNumber(final BigInteger holderSerialNumber) {
- return this.endorsementCredentialRepository.findBySerialNumber(holderSerialNumber);
+ return endorsementCredentialRepository.findBySerialNumber(holderSerialNumber);
}
/**
@@ -67,7 +67,7 @@ public EndorsementCredential findECBySerialNumber(final BigInteger holderSerialN
* @return total number of records in the platform credential repository.
*/
public long findPlatformCredentialRepositoryCount() {
- return this.platformCertificateRepository.findByArchiveFlag(false).size();
+ return platformCertificateRepository.countByArchiveFlag(false);
}
/**
@@ -86,8 +86,8 @@ public PlatformCredential parsePlatformCredential(final MultipartFile file, fina
try {
fileBytes = file.getBytes();
} catch (IOException ioEx) {
- final String failMessage = String.format(
- "Failed to read uploaded platform credential file (%s): ", fileName);
+ final String failMessage =
+ String.format("Failed to read uploaded platform credential file (%s): ", fileName);
log.error(failMessage, ioEx);
errorMessages.add(failMessage + ioEx.getMessage());
return null;
@@ -96,26 +96,25 @@ public PlatformCredential parsePlatformCredential(final MultipartFile file, fina
try {
return new PlatformCredential(fileBytes);
} catch (IOException ioEx) {
- final String failMessage = String.format(
- "Failed to parse uploaded platform credential file (%s): ", fileName);
+ final String failMessage =
+ String.format("Failed to parse uploaded platform credential file (%s): ", fileName);
log.error(failMessage, ioEx);
errorMessages.add(failMessage + ioEx.getMessage());
return null;
} catch (DecoderException dEx) {
- final String failMessage = String.format(
- "Failed to parse uploaded platform credential pem file (%s): ", fileName);
+ final String failMessage =
+ String.format("Failed to parse uploaded platform credential pem file (%s): ", fileName);
log.error(failMessage, dEx);
errorMessages.add(failMessage + dEx.getMessage());
return null;
} catch (IllegalArgumentException iaEx) {
- final String failMessage = String.format(
- "Platform credential format not recognized(%s): ", fileName);
+ final String failMessage = String.format("Platform credential format not recognized(%s): ", fileName);
log.error(failMessage, iaEx);
errorMessages.add(failMessage + iaEx.getMessage());
return null;
} catch (IllegalStateException isEx) {
- final String failMessage = String.format(
- "Unexpected object while parsing platform credential %s ", fileName);
+ final String failMessage =
+ String.format("Unexpected object while parsing platform credential %s ", fileName);
log.error(failMessage, isEx);
errorMessages.add(failMessage + isEx.getMessage());
return null;
diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/ReferenceDigestValuePageService.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/ReferenceDigestValuePageService.java
index 23821877e..447295941 100644
--- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/ReferenceDigestValuePageService.java
+++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/ReferenceDigestValuePageService.java
@@ -29,10 +29,10 @@
import java.util.UUID;
/**
- * A service layer class responsible for encapsulating all business logic related to the RIM Database Page.
+ * Service class responsible for encapsulating all business logic related to the RIM Database Page.
*/
-@Log4j2
@Service
+@Log4j2
public class ReferenceDigestValuePageService {
private final ReferenceManifestRepository referenceManifestRepository;
private final ReferenceDigestValueRepository referenceDigestValueRepository;
@@ -69,10 +69,8 @@ public Page findReferenceDigestValuesByGlobalSearchTerm(
final String globalSearchTerm,
final Pageable pageable) {
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
- CriteriaQuery query =
- criteriaBuilder.createQuery(ReferenceDigestValue.class);
- Root referenceDigestValueRoot =
- query.from(ReferenceDigestValue.class);
+ CriteriaQuery query = criteriaBuilder.createQuery(ReferenceDigestValue.class);
+ Root referenceDigestValueRoot = query.from(ReferenceDigestValue.class);
final Predicate combinedGlobalSearchPredicates =
createPredicatesForGlobalSearch(searchableColumnNames, criteriaBuilder,
@@ -109,10 +107,8 @@ public Page findReferenceDigestValuesByColumnSpecificSearc
final Set columnsWithSearchCriteria,
final Pageable pageable) {
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
- CriteriaQuery query =
- criteriaBuilder.createQuery(ReferenceDigestValue.class);
- Root referenceDigestValueRoot =
- query.from(ReferenceDigestValue.class);
+ CriteriaQuery query = criteriaBuilder.createQuery(ReferenceDigestValue.class);
+ Root referenceDigestValueRoot = query.from(ReferenceDigestValue.class);
final Predicate combinedColumnSearchPredicates =
createPredicatesForColumnSpecificSearch(columnsWithSearchCriteria, criteriaBuilder,
@@ -161,8 +157,7 @@ public Page findReferenceDigestValuesByGlobalAndColumnSpec
final Pageable pageable) {
CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
- CriteriaQuery query =
- criteriaBuilder.createQuery(ReferenceDigestValue.class);
+ CriteriaQuery query = criteriaBuilder.createQuery(ReferenceDigestValue.class);
Root referenceDigestValueRoot = query.from(ReferenceDigestValue.class);
final Predicate globalSearchPartOfChainedPredicates =
@@ -200,7 +195,7 @@ public Page findReferenceDigestValuesByGlobalAndColumnSpec
* @return page full of reference digest values
*/
public Page findAllReferenceDigestValues(final Pageable pageable) {
- return this.referenceDigestValueRepository.findAll(pageable);
+ return referenceDigestValueRepository.findAll(pageable);
}
/**
@@ -209,7 +204,7 @@ public Page findAllReferenceDigestValues(final Pageable pa
* @param referenceDigestValue reference digest value
*/
public void saveReferenceDigestValue(final ReferenceDigestValue referenceDigestValue) {
- this.referenceDigestValueRepository.save(referenceDigestValue);
+ referenceDigestValueRepository.save(referenceDigestValue);
}
/**
@@ -218,7 +213,7 @@ public void saveReferenceDigestValue(final ReferenceDigestValue referenceDigestV
* @return total number of records in the reference digest value repository.
*/
public long findReferenceDigestValueRepositoryCount() {
- return this.referenceDigestValueRepository.count();
+ return referenceDigestValueRepository.count();
}
/**
@@ -229,7 +224,7 @@ public long findReferenceDigestValueRepositoryCount() {
* otherwise it returns false if it doesn't exist
*/
public boolean doesRIMExist(final UUID uuid) {
- return this.referenceManifestRepository.existsById(uuid);
+ return referenceManifestRepository.existsById(uuid);
}
/**
@@ -239,7 +234,7 @@ public boolean doesRIMExist(final UUID uuid) {
* @return the found Reference Manifest
*/
public ReferenceManifest findRIMById(final UUID uuid) {
- return this.referenceManifestRepository.getReferenceById(uuid);
+ return referenceManifestRepository.getReferenceById(uuid);
}
/**
diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/ReferenceManifestPageService.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/ReferenceManifestPageService.java
index 7d2ad6b85..a4b21d7ac 100644
--- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/ReferenceManifestPageService.java
+++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/ReferenceManifestPageService.java
@@ -46,11 +46,10 @@
import java.util.zip.ZipOutputStream;
/**
- * A service layer class responsible for encapsulating all business logic related to the
- * Reference Manifest Page.
+ * Service class responsible for encapsulating all business logic related to the Reference Manifest Page.
*/
-@Log4j2
@Service
+@Log4j2
public class ReferenceManifestPageService {
private final ReferenceManifestRepository referenceManifestRepository;
private final ReferenceDigestValueRepository referenceDigestValueRepository;
@@ -87,7 +86,7 @@ public Page findRIMSByGlobalSearchTermAndArchiveFlag(
final String globalSearchTerm,
final boolean archiveFlag,
final Pageable pageable) {
- CriteriaBuilder criteriaBuilder = this.entityManager.getCriteriaBuilder();
+ CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery query = criteriaBuilder.createQuery(ReferenceManifest.class);
Root rimRoot = query.from(ReferenceManifest.class);
@@ -107,7 +106,7 @@ public Page findRIMSByGlobalSearchTermAndArchiveFlag(
query.orderBy(getSortingOrders(criteriaBuilder, rimRoot, pageable.getSort()));
// Apply pagination
- TypedQuery typedQuery = this.entityManager.createQuery(query);
+ TypedQuery typedQuery = entityManager.createQuery(query);
int totalRows = typedQuery.getResultList().size(); // Get the total count for pagination
typedQuery.setFirstResult((int) pageable.getOffset());
typedQuery.setMaxResults(pageable.getPageSize());
@@ -131,7 +130,7 @@ public Page findRIMSByColumnSpecificSearchTermAndArchiveFlag(
final Set columnsWithSearchCriteria,
final boolean archiveFlag,
final Pageable pageable) {
- CriteriaBuilder criteriaBuilder = this.entityManager.getCriteriaBuilder();
+ CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery query = criteriaBuilder.createQuery(ReferenceManifest.class);
Root rimRoot = query.from(ReferenceManifest.class);
@@ -150,7 +149,7 @@ public Page findRIMSByColumnSpecificSearchTermAndArchiveFlag(
query.orderBy(getSortingOrders(criteriaBuilder, rimRoot, pageable.getSort()));
// Apply pagination
- TypedQuery typedQuery = this.entityManager.createQuery(query);
+ TypedQuery typedQuery = entityManager.createQuery(query);
int totalRows = typedQuery.getResultList().size(); // Get the total count for pagination
typedQuery.setFirstResult((int) pageable.getOffset());
typedQuery.setMaxResults(pageable.getPageSize());
@@ -185,7 +184,7 @@ public Page findRIMSByGlobalAndColumnSpecificSearchTerm(
final Set columnsWithSearchCriteria,
final boolean archiveFlag,
final Pageable pageable) {
- CriteriaBuilder criteriaBuilder = this.entityManager.getCriteriaBuilder();
+ CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery query = criteriaBuilder.createQuery(ReferenceManifest.class);
Root rimRoot = query.from(ReferenceManifest.class);
@@ -210,7 +209,7 @@ public Page findRIMSByGlobalAndColumnSpecificSearchTerm(
query.orderBy(getSortingOrders(criteriaBuilder, rimRoot, pageable.getSort()));
// Apply pagination
- TypedQuery typedQuery = this.entityManager.createQuery(query);
+ TypedQuery typedQuery = entityManager.createQuery(query);
int totalRows = typedQuery.getResultList().size(); // Get the total count for pagination
typedQuery.setFirstResult((int) pageable.getOffset());
typedQuery.setMaxResults(pageable.getPageSize());
@@ -226,8 +225,9 @@ public Page findRIMSByGlobalAndColumnSpecificSearchTerm(
* @param pageable pageable
* @return page of RIMs
*/
- public Page findAllBaseAndSupportRIMSByPageable(final Pageable pageable) {
- return this.referenceManifestRepository.findAllBaseAndSupportRimsPageable(pageable);
+ public Page findAllBaseAndSupportRIMS(final Pageable pageable) {
+ return referenceManifestRepository.findByClassIn(
+ List.of(BaseReferenceManifest.class, SupportReferenceManifest.class), pageable);
}
/**
@@ -236,7 +236,7 @@ public Page findAllBaseAndSupportRIMSByPageable(final Pageabl
* @return total number of records in the RIM repository.
*/
public long findRIMRepositoryCount() {
- return this.referenceManifestRepository.findByArchiveFlag(false).size();
+ return referenceManifestRepository.countByArchiveFlag(false);
}
/**
@@ -259,7 +259,7 @@ public ReferenceManifest findSpecifiedRIM(final UUID uuid) {
* @return download file of a RIM
*/
public DownloadFile downloadRIM(final UUID uuid) {
- final ReferenceManifest referenceManifest = this.findSpecifiedRIM(uuid);
+ final ReferenceManifest referenceManifest = findSpecifiedRIM(uuid);
if (referenceManifest == null) {
final String notFoundMessage = "Unable to locate RIM with ID: " + uuid;
@@ -277,7 +277,7 @@ public DownloadFile downloadRIM(final UUID uuid) {
* @throws IOException if there are any issues packaging or downloading the zip file
*/
public void bulkDownloadRIMS(final ZipOutputStream zipOut) throws IOException {
- List allRIMs = this.referenceManifestRepository.findAll();
+ List allRIMs = referenceManifestRepository.findAll();
// create a list of all the RIMs that are of base rim or support rim type
final List referenceManifestList =
@@ -309,7 +309,7 @@ public void bulkDownloadRIMS(final ZipOutputStream zipOut) throws IOException {
public void deleteRIM(final UUID uuid,
final List successMessages,
final List errorMessages) {
- ReferenceManifest referenceManifest = this.findSpecifiedRIM(uuid);
+ ReferenceManifest referenceManifest = findSpecifiedRIM(uuid);
if (referenceManifest == null) {
final String notFoundMessage = "Unable to locate RIM to delete with ID: " + uuid;
@@ -318,7 +318,7 @@ public void deleteRIM(final UUID uuid,
throw new EntityNotFoundException(notFoundMessage);
}
- this.referenceManifestRepository.delete(referenceManifest);
+ referenceManifestRepository.delete(referenceManifest);
final String deleteCompletedMessage = "RIM successfully deleted";
successMessages.add(deleteCompletedMessage);
@@ -357,10 +357,10 @@ public void storeRIMS(final List successMessages,
// save the base rims in the repo if they don't already exist in the repo
baseRims.forEach((baseRIM) -> {
- if (this.referenceManifestRepository.findByHexDecHashAndRimType(
+ if (referenceManifestRepository.findByHexDecHashAndRimType(
baseRIM.getHexDecHash(), baseRIM.getRimType()) == null) {
final String successMessage = "Stored swidtag " + baseRIM.getFileName() + " successfully";
- this.referenceManifestRepository.save(baseRIM);
+ referenceManifestRepository.save(baseRIM);
log.info(successMessage);
successMessages.add(successMessage);
}
@@ -368,11 +368,10 @@ public void storeRIMS(final List successMessages,
// save the support rims in the repo if they don't already exist in the repo
supportRims.forEach((supportRIM) -> {
- if (this.referenceManifestRepository.findByHexDecHashAndRimType(
+ if (referenceManifestRepository.findByHexDecHashAndRimType(
supportRIM.getHexDecHash(), supportRIM.getRimType()) == null) {
- final String successMessage =
- "Stored event log " + supportRIM.getFileName() + " successfully";
- this.referenceManifestRepository.save(supportRIM);
+ final String successMessage = "Stored event log " + supportRIM.getFileName() + " successfully";
+ referenceManifestRepository.save(supportRIM);
log.info(successMessage);
successMessages.add(successMessage);
}
@@ -383,7 +382,7 @@ public void storeRIMS(final List successMessages,
// or already exist create a map of the supports rims in case an uploaded swidtag
// isn't one to one with the uploaded support rims.
Map updatedSupportRims
- = updateSupportRimInfo(this.referenceManifestRepository.findAllSupportRims());
+ = updateSupportRimInfo(referenceManifestRepository.findAllSupportRims());
// pass in the updated support rims
// and either update or add the events
@@ -404,8 +403,7 @@ public BaseReferenceManifest parseBaseRIM(final List errorMessages, fina
try {
fileBytes = file.getBytes();
} catch (IOException e) {
- final String failMessage =
- String.format("Failed to read uploaded Base RIM file (%s): ", fileName);
+ final String failMessage = String.format("Failed to read uploaded Base RIM file (%s): ", fileName);
log.error(failMessage, e);
errorMessages.add(failMessage + e.getMessage());
}
@@ -436,8 +434,7 @@ public SupportReferenceManifest parseSupportRIM(final List errorMessages
try {
fileBytes = file.getBytes();
} catch (IOException e) {
- final String failMessage =
- String.format("Failed to read uploaded Support RIM file (%s): ", fileName);
+ final String failMessage = String.format("Failed to read uploaded Support RIM file (%s): ", fileName);
log.error(failMessage, e);
errorMessages.add(failMessage + e.getMessage());
}
@@ -553,8 +550,7 @@ private Map updateSupportRimInfo(
hashValues.put(support.getHexDecHash(), support);
}
- List baseReferenceManifests =
- this.referenceManifestRepository.findAllBaseRims();
+ List baseReferenceManifests = referenceManifestRepository.findAllBaseRims();
for (BaseReferenceManifest dbBaseRim : baseReferenceManifests) {
for (Map.Entry entry : hashValues.entrySet()) {
@@ -573,11 +569,11 @@ private Map updateSupportRimInfo(
supportRim.setAssociatedRim(dbBaseRim.getId());
dbBaseRim.setAssociatedRim(supportRim.getId());
supportRim.setUpdated(true);
- this.referenceManifestRepository.save(supportRim);
+ referenceManifestRepository.save(supportRim);
updatedSupportRims.put(supportHash, supportRim);
}
}
- this.referenceManifestRepository.save(dbBaseRim);
+ referenceManifestRepository.save(dbBaseRim);
}
return updatedSupportRims;
@@ -592,7 +588,7 @@ private Map updateSupportRimInfo(
*/
private ReferenceManifest findBaseRim(final SupportReferenceManifest supportRim) {
if (supportRim != null && (supportRim.getId() != null && !supportRim.getId().toString().isEmpty())) {
- List baseRims = new LinkedList<>(this.referenceManifestRepository
+ List baseRims = new LinkedList<>(referenceManifestRepository
.getBaseByManufacturerModel(supportRim.getPlatformManufacturer(),
supportRim.getPlatformModel()));
@@ -629,7 +625,7 @@ private void processTpmEvents(final List dbSupportRims
tpe.getEventTypeStr(), false, false,
true, tpe.getEventContent());
- this.referenceDigestValueRepository.save(newRdv);
+ referenceDigestValueRepository.save(newRdv);
}
} catch (CertificateException | NoSuchAlgorithmException | IOException e) {
e.printStackTrace();
@@ -638,7 +634,7 @@ private void processTpmEvents(final List dbSupportRims
for (ReferenceDigestValue referenceValue : referenceValues) {
if (!referenceValue.isUpdated()) {
referenceValue.updateInfo(dbSupport, baseRim.getId());
- this.referenceDigestValueRepository.save(referenceValue);
+ referenceDigestValueRepository.save(referenceValue);
}
}
}
@@ -646,3 +642,5 @@ private void processTpmEvents(final List dbSupportRims
}
}
}
+
+
diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/TrustChainCertificatePageService.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/TrustChainCertificatePageService.java
index c6dfb3e19..1de2c46fe 100644
--- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/TrustChainCertificatePageService.java
+++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/TrustChainCertificatePageService.java
@@ -9,11 +9,11 @@
import org.springframework.stereotype.Service;
/**
- * A service layer class responsible for encapsulating all business logic related to the Trust Chain
+ * Service class responsible for encapsulating all business logic related to the Trust Chain
* Certificates Management Page.
*/
-@Log4j2
@Service
+@Log4j2
public class TrustChainCertificatePageService {
private final CACredentialRepository caCredentialRepository;
@@ -33,7 +33,7 @@ public TrustChainCertificatePageService(final CACredentialRepository caCredentia
* @return total number of records in the certificate authority (trust chain) repository.
*/
public long findTrustChainCertificateRepoCount() {
- return this.caCredentialRepository.findByArchiveFlag(false).size();
+ return caCredentialRepository.countByArchiveFlag(false);
}
/**
@@ -45,6 +45,6 @@ public long findTrustChainCertificateRepoCount() {
*/
public Page findCACredentialsByArchiveFlag(final boolean archiveFlag,
final Pageable pageable) {
- return this.caCredentialRepository.findByArchiveFlag(archiveFlag, pageable);
+ return caCredentialRepository.findByArchiveFlag(archiveFlag, pageable);
}
}
diff --git a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/ValidationSummaryPageService.java b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/ValidationSummaryPageService.java
index 3aad1cccb..2b42aadbe 100644
--- a/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/ValidationSummaryPageService.java
+++ b/HIRS_AttestationCA/src/main/java/hirs/attestationca/persist/service/ValidationSummaryPageService.java
@@ -53,8 +53,7 @@
import java.util.regex.Pattern;
/**
- * A service layer class responsible for encapsulating all business logic related to the Validation Summary
- * Page.
+ * Service class responsible for encapsulating all business logic related to the Validation Summary Page.
*/
@Service
@Log4j2
@@ -111,7 +110,7 @@ public Page findValidationReportsByGlobalSearchTer
final String globalSearchTerm,
final boolean archiveFlag,
final Pageable pageable) {
- CriteriaBuilder criteriaBuilder = this.entityManager.getCriteriaBuilder();
+ CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery query =
criteriaBuilder.createQuery(SupplyChainValidationSummary.class);
Root supplyChainValidationSummaryRoot =
@@ -133,7 +132,7 @@ public Page findValidationReportsByGlobalSearchTer
getSortingOrders(criteriaBuilder, supplyChainValidationSummaryRoot, pageable.getSort()));
// Apply pagination
- TypedQuery typedQuery = this.entityManager.createQuery(query);
+ TypedQuery typedQuery = entityManager.createQuery(query);
int totalRows = typedQuery.getResultList().size(); // Get the total count for pagination
typedQuery.setFirstResult((int) pageable.getOffset());
typedQuery.setMaxResults(pageable.getPageSize());
@@ -158,7 +157,7 @@ public Page findValidationReportsByGlobalSearchTer
final Set columnsWithSearchCriteria,
final boolean archiveFlag,
final Pageable pageable) {
- CriteriaBuilder criteriaBuilder = this.entityManager.getCriteriaBuilder();
+ CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery query =
criteriaBuilder.createQuery(SupplyChainValidationSummary.class);
Root supplyChainValidationSummaryRoot =
@@ -176,7 +175,7 @@ public Page findValidationReportsByGlobalSearchTer
getSortingOrders(criteriaBuilder, supplyChainValidationSummaryRoot, pageable.getSort()));
// Apply pagination
- TypedQuery typedQuery = this.entityManager.createQuery(query);
+ TypedQuery typedQuery = entityManager.createQuery(query);
int totalRows = typedQuery.getResultList().size(); // Get the total count for pagination
typedQuery.setFirstResult((int) pageable.getOffset());
typedQuery.setMaxResults(pageable.getPageSize());
@@ -213,7 +212,7 @@ public Page findValidationSummaryReportsByGlobalAn
final Set columnsWithSearchCriteria,
final boolean archiveFlag,
final Pageable pageable) {
- CriteriaBuilder criteriaBuilder = this.entityManager.getCriteriaBuilder();
+ CriteriaBuilder criteriaBuilder = entityManager.getCriteriaBuilder();
CriteriaQuery query =
criteriaBuilder.createQuery(SupplyChainValidationSummary.class);
Root supplyChainValidationSummaryRoot =
@@ -241,7 +240,7 @@ public Page findValidationSummaryReportsByGlobalAn
getSortingOrders(criteriaBuilder, supplyChainValidationSummaryRoot, pageable.getSort()));
// Apply pagination
- TypedQuery typedQuery = this.entityManager.createQuery(query);
+ TypedQuery typedQuery = entityManager.createQuery(query);
int totalRows = typedQuery.getResultList().size(); // Get the total count for pagination
typedQuery.setFirstResult((int) pageable.getOffset());
typedQuery.setMaxResults(pageable.getPageSize());
@@ -257,9 +256,8 @@ public Page findValidationSummaryReportsByGlobalAn
* @param pageable pageable
* @return page of supply chain validation summaries
*/
- public Page findValidationSummaryReportsByPageable(
- final Pageable pageable) {
- return this.supplyChainValidationSummaryRepository.findByArchiveFlagFalse(pageable);
+ public Page findValidationSummaryReportsByPageable(final Pageable pageable) {
+ return supplyChainValidationSummaryRepository.findByArchiveFlagFalse(pageable);
}
/**
@@ -268,7 +266,7 @@ public Page findValidationSummaryReportsByPageable
* @return total number of records in the supply chain validation summary repository
*/
public long findValidationSummaryRepositoryCount() {
- return this.supplyChainValidationSummaryRepository.count();
+ return supplyChainValidationSummaryRepository.count();
}
/**
@@ -290,7 +288,7 @@ public void downloadValidationReports(final HttpServletRequest request,
LocalDate startDate = null;
LocalDate endDate = null;
ArrayList createTimes = new ArrayList<>();
- String[] deviceNames = new String[] {};
+ String[] deviceNames = new String[]{};
final Enumeration parameters = request.getParameterNames();
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/CertificateDetailsPageController.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/CertificateDetailsPageController.java
index 091075599..dba2eb952 100644
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/CertificateDetailsPageController.java
+++ b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/CertificateDetailsPageController.java
@@ -22,9 +22,9 @@
/**
* Controller for the Certificate Details page.
*/
-@Log4j2
@Controller
@RequestMapping("/HIRS_AttestationCAPortal/portal/certificate-details")
+@Log4j2
public class CertificateDetailsPageController extends PageController {
/**
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/DevicePageController.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/DevicePageController.java
index 795eae1fc..87f28b03a 100644
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/DevicePageController.java
+++ b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/DevicePageController.java
@@ -29,9 +29,9 @@
/**
* Controller for the Devices page.
*/
-@Log4j2
@Controller
@RequestMapping("/HIRS_AttestationCAPortal/portal/devices")
+@Log4j2
public class DevicePageController extends PageController {
private final DevicePageService devicePageService;
@@ -109,7 +109,7 @@ public DataTableResponse> getDevicesTableData(
pageable);
FilteredRecordsList> devicesAndAssociatedCertificates
- = this.devicePageService.retrieveDevicesAndAssociatedCertificates(deviceList);
+ = devicePageService.retrieveDevicesAndAssociatedCertificates(deviceList);
log.info("Returning the size of the filtered list of devices: {}",
devicesAndAssociatedCertificates.size());
@@ -140,7 +140,7 @@ public DataTableResponse> getDevicesTableData(
* @param columnsWithSearchCriteria A set of columns with specific search criteria entered by the user.
* @param searchableColumnNames A set of searchable column names that are for the global search term.
* @param pageable pageable
- * @return A {@link FilteredRecordsList} containing the filtered and paginated list of devices,
+ * @return A {@link FilteredRecordsList} containing the filtered and paginated list of devices,
* along with the total number of records and the number of records matching the filter criteria.
*/
private FilteredRecordsList getFilteredDeviceList(
@@ -153,24 +153,21 @@ private FilteredRecordsList getFilteredDeviceList(
// if no value has been entered in the global search textbox and in the column search dropdown
if (StringUtils.isBlank(globalSearchTerm) && columnsWithSearchCriteria.isEmpty()) {
- pagedResult =
- this.devicePageService.findAllDevices(pageable);
+ pagedResult = devicePageService.findAllDevices(pageable);
} else if (!StringUtils.isBlank(globalSearchTerm) && !columnsWithSearchCriteria.isEmpty()) {
// if a value has been entered in both the global search textbox and in the column search dropdown
- pagedResult =
- this.devicePageService.findDevicesByGlobalAndColumnSpecificSearchTerm(
- searchableColumnNames,
- globalSearchTerm,
- columnsWithSearchCriteria,
- pageable);
+ pagedResult = devicePageService.findDevicesByGlobalAndColumnSpecificSearchTerm(
+ searchableColumnNames,
+ globalSearchTerm,
+ columnsWithSearchCriteria,
+ pageable);
} else if (!columnsWithSearchCriteria.isEmpty()) {
// if a value has been entered ONLY in the column search dropdown
- pagedResult =
- this.devicePageService.findDevicesByColumnSpecificSearchTerm(columnsWithSearchCriteria,
- pageable);
+ pagedResult = devicePageService.findDevicesByColumnSpecificSearchTerm(columnsWithSearchCriteria,
+ pageable);
} else {
// if a value has been entered ONLY in the global search textbox
- pagedResult = this.devicePageService.findDevicesByGlobalSearchTerm(
+ pagedResult = devicePageService.findDevicesByGlobalSearchTerm(
searchableColumnNames,
globalSearchTerm,
pageable);
@@ -181,7 +178,7 @@ private FilteredRecordsList getFilteredDeviceList(
deviceList.addAll(pagedResult.getContent());
}
deviceList.setRecordsFiltered(pagedResult.getTotalElements());
- deviceList.setRecordsTotal(this.devicePageService.findDeviceRepositoryCount());
+ deviceList.setRecordsTotal(devicePageService.findDeviceRepositoryCount());
return deviceList;
}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/EndorsementCredentialPageController.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/EndorsementCredentialPageController.java
index 8abcd2690..6b8cdcbb7 100644
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/EndorsementCredentialPageController.java
+++ b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/EndorsementCredentialPageController.java
@@ -47,9 +47,9 @@
/**
* Controller for the Endorsement Key Credentials page.
*/
-@Log4j2
@Controller
@RequestMapping("/HIRS_AttestationCAPortal/portal/certificate-request/endorsement-key-credentials")
+@Log4j2
public class EndorsementCredentialPageController extends PageController {
private final EndorsementCredentialPageService endorsementCredentialPageService;
private final CertificatePageService certificatePageService;
@@ -145,9 +145,8 @@ public void downloadEndorsementCredential(@RequestParam final String id,
log.info("Received request to download endorsement credential id {}", id);
try {
- final DownloadFile downloadFile =
- this.certificatePageService.downloadCertificate(EndorsementCredential.class,
- UUID.fromString(id));
+ final DownloadFile downloadFile = certificatePageService.downloadCertificate(EndorsementCredential.class,
+ UUID.fromString(id));
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;" + downloadFile.getFileName());
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
response.getOutputStream().write(downloadFile.getFileBytes());
@@ -176,8 +175,7 @@ public void bulkDownloadEndorsementCredentials(final HttpServletResponse respons
response.setContentType("application/zip");
try (ZipOutputStream zipOut = new ZipOutputStream(response.getOutputStream())) {
- this.certificatePageService.bulkDownloadCertificates(zipOut,
- CertificateType.ENDORSEMENT_CREDENTIALS,
+ certificatePageService.bulkDownloadCertificates(zipOut, CertificateType.ENDORSEMENT_CREDENTIALS,
singleFileName);
} catch (Exception exception) {
log.error("An exception was thrown while attempting to bulk download all the "
@@ -208,10 +206,10 @@ protected RedirectView uploadEndorsementCredential(@RequestParam("file") final M
List successMessages = new ArrayList<>();
EndorsementCredential parsedEndorsementCredential =
- this.endorsementCredentialPageService.parseEndorsementCredential(file, errorMessages);
+ endorsementCredentialPageService.parseEndorsementCredential(file, errorMessages);
if (parsedEndorsementCredential != null) {
- this.certificatePageService.storeCertificate(CertificateType.ENDORSEMENT_CREDENTIALS,
+ certificatePageService.storeCertificate(CertificateType.ENDORSEMENT_CREDENTIALS,
file.getOriginalFilename(),
successMessages, errorMessages, parsedEndorsementCredential);
}
@@ -246,8 +244,7 @@ public RedirectView deleteEndorsementCredential(@RequestParam final String id,
List errorMessages = new ArrayList<>();
try {
- this.certificatePageService.deleteCertificate(UUID.fromString(id),
- successMessages, errorMessages);
+ certificatePageService.deleteCertificate(UUID.fromString(id), successMessages, errorMessages);
messages.addSuccessMessages(successMessages);
messages.addErrorMessages(errorMessages);
@@ -283,7 +280,7 @@ public RedirectView bulkDeleteEndorsementCredentials(@RequestParam final List errorMessages = new ArrayList<>();
try {
- this.certificatePageService.bulkDeleteCertificates(ids, successMessages,
+ certificatePageService.bulkDeleteCertificates(ids, successMessages,
errorMessages);
messages.addSuccessMessages(successMessages);
messages.addErrorMessages(errorMessages);
@@ -335,29 +332,27 @@ private FilteredRecordsList getFilteredEndorsementCredent
// if no value has been entered in the global search textbox and in the column search dropdown
if (StringUtils.isBlank(globalSearchTerm) && columnsWithSearchCriteria.isEmpty()) {
- pagedResult = this.endorsementCredentialPageService.
- findEndorsementCredentialsByArchiveFlag(false, pageable);
+ pagedResult =
+ endorsementCredentialPageService.findEndorsementCredentialsByArchiveFlag(false, pageable);
} else if (!StringUtils.isBlank(globalSearchTerm) && !columnsWithSearchCriteria.isEmpty()) {
// if a value has been entered in both the global search textbox and in the column search dropdown
- pagedResult =
- this.certificatePageService.findCertificatesByGlobalAndColumnSpecificSearchTerm(
- EndorsementCredential.class,
- searchableColumnNames,
- globalSearchTerm,
- columnsWithSearchCriteria,
- false,
- pageable);
+ pagedResult = certificatePageService.findCertificatesByGlobalAndColumnSpecificSearchTerm(
+ EndorsementCredential.class,
+ searchableColumnNames,
+ globalSearchTerm,
+ columnsWithSearchCriteria,
+ false,
+ pageable);
} else if (!columnsWithSearchCriteria.isEmpty()) {
// if a value has been entered ONLY in the column search dropdown
- pagedResult =
- this.certificatePageService.findCertificatesByColumnSpecificSearchTermAndArchiveFlag(
- EndorsementCredential.class,
- columnsWithSearchCriteria,
- false,
- pageable);
+ pagedResult = certificatePageService.findCertificatesByColumnSpecificSearchTermAndArchiveFlag(
+ EndorsementCredential.class,
+ columnsWithSearchCriteria,
+ false,
+ pageable);
} else {
// if a value has been entered ONLY in the global search textbox
- pagedResult = this.certificatePageService.findCertificatesByGlobalSearchTermAndArchiveFlag(
+ pagedResult = certificatePageService.findCertificatesByGlobalSearchTermAndArchiveFlag(
EndorsementCredential.class,
searchableColumnNames,
globalSearchTerm,
@@ -372,7 +367,7 @@ private FilteredRecordsList getFilteredEndorsementCredent
ekFilteredRecordsList.setRecordsFiltered(pagedResult.getTotalElements());
ekFilteredRecordsList.setRecordsTotal(
- this.endorsementCredentialPageService.findEndorsementCredentialRepositoryCount());
+ endorsementCredentialPageService.findEndorsementCredentialRepositoryCount());
return ekFilteredRecordsList;
}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/HelpPageController.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/HelpPageController.java
index fbe8e49ac..e29e1b34d 100644
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/HelpPageController.java
+++ b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/HelpPageController.java
@@ -36,9 +36,9 @@
/**
* Controller for the Help page.
*/
-@Log4j2
@Controller
@RequestMapping("/HIRS_AttestationCAPortal/portal/help")
+@Log4j2
public class HelpPageController extends PageController {
private final HelpPageService helpPageService;
@@ -65,31 +65,6 @@ public ModelAndView initPage(final NoPageParams params, final Model model) {
return getBaseModelAndView(Page.HELP);
}
- /**
- * Processes the request to download a zip file of the HIRS application's log files.
- *
- * @param response response that will be sent out after processing download request
- * @throws IOException when writing to response output stream
- */
- @GetMapping("/hirs-logs-download")
- public void downloadHIRSLogs(final HttpServletResponse response) throws IOException {
- log.info(
- "Received request to download a zip file of all the HIRS Attestation application's log files");
-
- final String zipFileName = "HIRS_AttestationCAPortal_Logs.zip";
-
- response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + zipFileName);
- response.setContentType("application/zip");
-
- try (ZipOutputStream zipOut = new ZipOutputStream(response.getOutputStream())) {
- this.helpPageService.bulkDownloadHIRSLogFiles(zipOut);
- } catch (Exception exception) {
- log.error("An exception was thrown while attempting to bulk download all the "
- + "HIRS Attestation Logs", exception);
- response.sendError(HttpServletResponse.SC_NOT_FOUND);
- }
- }
-
/**
* Processes the request to retrieve the main HIRS logger for display on the help page.
*
@@ -106,7 +81,7 @@ public DataTableResponse getMainHIRSLogger(final DataTableInput data
FilteredRecordsList mainHIRSLoggersFilteredRecordsList = new FilteredRecordsList<>();
- final HIRSLogger mainHIRSLogger = this.helpPageService.getMainHIRSLogger();
+ final HIRSLogger mainHIRSLogger = helpPageService.getMainHIRSLogger();
mainHIRSLoggersFilteredRecordsList.add(mainHIRSLogger);
mainHIRSLoggersFilteredRecordsList.setRecordsTotal(1);
mainHIRSLoggersFilteredRecordsList.setRecordsFiltered(1);
@@ -117,6 +92,30 @@ public DataTableResponse getMainHIRSLogger(final DataTableInput data
return new DataTableResponse<>(mainHIRSLoggersFilteredRecordsList, dataTableInput);
}
+ /**
+ * Processes the request to download a zip file of the HIRS application's log files.
+ *
+ * @param response response that will be sent out after processing download request
+ * @throws IOException when writing to response output stream
+ */
+ @GetMapping("/hirs-logs-download")
+ public void downloadHIRSLogs(final HttpServletResponse response) throws IOException {
+ log.info("Received request to download a zip file of all the HIRS Attestation application's log files");
+
+ final String zipFileName = "HIRS_AttestationCAPortal_Logs.zip";
+
+ response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment; filename=" + zipFileName);
+ response.setContentType("application/zip");
+
+ try (ZipOutputStream zipOut = new ZipOutputStream(response.getOutputStream())) {
+ helpPageService.bulkDownloadHIRSLogFiles(zipOut);
+ } catch (Exception exception) {
+ log.error("An exception was thrown while attempting to bulk download all the "
+ + "HIRS Attestation Logs", exception);
+ response.sendError(HttpServletResponse.SC_NOT_FOUND);
+ }
+ }
+
/**
* Processes the request that sets the log level of the selected logger.
*
@@ -140,14 +139,13 @@ public RedirectView setLogLevel(@RequestParam final String loggerName,
log.info("Received a request to set the log level [{}] for the provided logger [{}]", logLevel,
loggerName);
- this.helpPageService.setLoggerLevel(loggerName, logLevel, successMessages, errorMessages);
+ helpPageService.setLoggerLevel(loggerName, logLevel, successMessages, errorMessages);
messages.addSuccessMessages(successMessages);
messages.addErrorMessages(errorMessages);
} catch (Exception exception) {
- final String errorMessage =
- "An exception was thrown while attempting to set the logging level for the"
- + " selected logger";
+ final String errorMessage = "An exception was thrown while attempting to set the logging level for the"
+ + " selected logger";
log.error(errorMessage, exception);
messages.addErrorMessage(errorMessage);
}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/IDevIdCertificatePageController.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/IDevIdCertificatePageController.java
index 985e066b4..0c8e5f945 100644
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/IDevIdCertificatePageController.java
+++ b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/IDevIdCertificatePageController.java
@@ -47,9 +47,9 @@
/**
* Controller for the IDevID Certificates page.
*/
-@Log4j2
@Controller
@RequestMapping("/HIRS_AttestationCAPortal/portal/certificate-request/idevid-certificates")
+@Log4j2
public class IDevIdCertificatePageController extends PageController {
private final CertificatePageService certificatePageService;
private final IDevIdCertificatePageService iDevIdCertificatePageService;
@@ -143,8 +143,7 @@ public void downloadIDevIdCertificate(@RequestParam final String id, final HttpS
try {
final DownloadFile downloadFile =
- this.certificatePageService.downloadCertificate(IDevIDCertificate.class,
- UUID.fromString(id));
+ certificatePageService.downloadCertificate(IDevIDCertificate.class, UUID.fromString(id));
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;" + downloadFile.getFileName());
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
response.getOutputStream().write(downloadFile.getFileBytes());
@@ -173,7 +172,7 @@ public void bulkDownloadIDevIdCertificates(final HttpServletResponse response) t
response.setContentType("application/zip");
try (ZipOutputStream zipOut = new ZipOutputStream(response.getOutputStream())) {
- this.certificatePageService.bulkDownloadCertificates(zipOut, CertificateType.IDEVID_CERTIFICATES,
+ certificatePageService.bulkDownloadCertificates(zipOut, CertificateType.IDEVID_CERTIFICATES,
singleFileName);
} catch (Exception exception) {
log.error("An exception was thrown while attempting to bulk download all the idevid certificates",
@@ -204,11 +203,10 @@ protected RedirectView uploadIDevIdCertificate(@RequestParam("file") final Multi
List successMessages = new ArrayList<>();
IDevIDCertificate parsedIDevIDCertificate =
- this.iDevIdCertificatePageService.parseIDevIDCertificate(file, errorMessages);
+ iDevIdCertificatePageService.parseIDevIDCertificate(file, errorMessages);
if (parsedIDevIDCertificate != null) {
- certificatePageService.storeCertificate(CertificateType.IDEVID_CERTIFICATES,
- file.getOriginalFilename(),
+ certificatePageService.storeCertificate(CertificateType.IDEVID_CERTIFICATES, file.getOriginalFilename(),
successMessages, errorMessages, parsedIDevIDCertificate);
}
@@ -242,8 +240,7 @@ public RedirectView deleteIdevIdCertificate(@RequestParam final String id,
List errorMessages = new ArrayList<>();
try {
- this.certificatePageService.deleteCertificate(UUID.fromString(id), successMessages,
- errorMessages);
+ certificatePageService.deleteCertificate(UUID.fromString(id), successMessages, errorMessages);
messages.addSuccessMessages(successMessages);
messages.addErrorMessages(errorMessages);
} catch (Exception exception) {
@@ -279,13 +276,12 @@ public RedirectView bulkDeleteIDevIdCertificates(@RequestParam final List errorMessages = new ArrayList<>();
try {
- this.certificatePageService.bulkDeleteCertificates(ids, successMessages,
- errorMessages);
+ certificatePageService.bulkDeleteCertificates(ids, successMessages, errorMessages);
messages.addSuccessMessages(successMessages);
messages.addErrorMessages(errorMessages);
} catch (Exception exception) {
- final String errorMessage = "An exception was thrown while attempting to delete"
- + " multiple idevid certificates";
+ final String errorMessage =
+ "An exception was thrown while attempting to delete multiple idevid certificates";
messages.addErrorMessage(errorMessage);
log.error(errorMessage, exception);
}
@@ -331,29 +327,26 @@ private FilteredRecordsList getFilteredIDevIdCertificateList(
// if no value has been entered in the global search textbox and in the column search dropdown
if (StringUtils.isBlank(globalSearchTerm) && columnsWithSearchCriteria.isEmpty()) {
- pagedResult = this.iDevIdCertificatePageService.
- findIDevCertificatesByArchiveFlag(false, pageable);
+ pagedResult = iDevIdCertificatePageService.findIDevCertificatesByArchiveFlag(false, pageable);
} else if (!StringUtils.isBlank(globalSearchTerm) && !columnsWithSearchCriteria.isEmpty()) {
// if a value has been entered in both the global search textbox and in the column search dropdown
- pagedResult =
- this.certificatePageService.findCertificatesByGlobalAndColumnSpecificSearchTerm(
- IDevIDCertificate.class,
- searchableColumnNames,
- globalSearchTerm,
- columnsWithSearchCriteria,
- false,
- pageable);
+ pagedResult = certificatePageService.findCertificatesByGlobalAndColumnSpecificSearchTerm(
+ IDevIDCertificate.class,
+ searchableColumnNames,
+ globalSearchTerm,
+ columnsWithSearchCriteria,
+ false,
+ pageable);
} else if (!columnsWithSearchCriteria.isEmpty()) {
// if a value has been entered ONLY in the column search dropdown
- pagedResult =
- this.certificatePageService.findCertificatesByColumnSpecificSearchTermAndArchiveFlag(
- IDevIDCertificate.class,
- columnsWithSearchCriteria,
- false,
- pageable);
+ pagedResult = certificatePageService.findCertificatesByColumnSpecificSearchTermAndArchiveFlag(
+ IDevIDCertificate.class,
+ columnsWithSearchCriteria,
+ false,
+ pageable);
} else {
// if a value has been entered ONLY in the global search textbox
- pagedResult = this.certificatePageService.findCertificatesByGlobalSearchTermAndArchiveFlag(
+ pagedResult = certificatePageService.findCertificatesByGlobalSearchTermAndArchiveFlag(
IDevIDCertificate.class,
searchableColumnNames,
globalSearchTerm,
@@ -366,8 +359,7 @@ private FilteredRecordsList getFilteredIDevIdCertificateList(
}
idevidFilteredRecordsList.setRecordsFiltered(pagedResult.getTotalElements());
- idevidFilteredRecordsList.setRecordsTotal(
- this.iDevIdCertificatePageService.findIDevIdCertificateRepositoryCount());
+ idevidFilteredRecordsList.setRecordsTotal(iDevIdCertificatePageService.findIDevIdCertificateRepositoryCount());
return idevidFilteredRecordsList;
}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/IndexPageController.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/IndexPageController.java
index eb4f79117..1e1d2d531 100644
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/IndexPageController.java
+++ b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/IndexPageController.java
@@ -13,9 +13,9 @@
* Controller for the Index page.
*/
@Controller
+@RequestMapping(value = {"/", "/HIRS_AttestationCAPortal", "/HIRS_AttestationCAPortal/",
+ "/HIRS_AttestationCAPortal/portal/index"})
@Log4j2
-@RequestMapping(value = {"/", "/HIRS_AttestationCAPortal",
- "/HIRS_AttestationCAPortal/", "/HIRS_AttestationCAPortal/portal/index"})
public class IndexPageController extends PageController {
/**
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/IssuedCertificatePageController.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/IssuedCertificatePageController.java
index d71aa1025..75c6ef54d 100644
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/IssuedCertificatePageController.java
+++ b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/IssuedCertificatePageController.java
@@ -46,9 +46,9 @@
/**
* Controller for the Issued Certificates page.
*/
-@Log4j2
@Controller
@RequestMapping("/HIRS_AttestationCAPortal/portal/certificate-request/issued-certificates")
+@Log4j2
public class IssuedCertificatePageController extends PageController {
private final IssuedAttestationCertificatePageService issuedAttestationCertificateService;
private final CertificatePageService certificatePageService;
@@ -145,8 +145,7 @@ public void downloadIssuedCertificate(@RequestParam final String id, final HttpS
try {
final DownloadFile downloadFile =
- this.certificatePageService.downloadCertificate(IssuedAttestationCertificate.class,
- UUID.fromString(id));
+ certificatePageService.downloadCertificate(IssuedAttestationCertificate.class, UUID.fromString(id));
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;" + downloadFile.getFileName());
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
response.getOutputStream().write(downloadFile.getFileBytes());
@@ -176,7 +175,7 @@ public void bulkDownloadIssuedCertificates(final HttpServletResponse response)
response.setContentType("application/zip");
try (ZipOutputStream zipOut = new ZipOutputStream(response.getOutputStream())) {
- this.certificatePageService.bulkDownloadCertificates(zipOut, CertificateType.ISSUED_CERTIFICATES,
+ certificatePageService.bulkDownloadCertificates(zipOut, CertificateType.ISSUED_CERTIFICATES,
singleFileName);
} catch (Exception exception) {
log.error("An exception was thrown while attempting to bulk download all the "
@@ -207,8 +206,7 @@ public RedirectView deleteIssuedCertificate(@RequestParam final String id,
List errorMessages = new ArrayList<>();
try {
- this.certificatePageService.deleteCertificate(UUID.fromString(id), successMessages,
- errorMessages);
+ certificatePageService.deleteCertificate(UUID.fromString(id), successMessages, errorMessages);
messages.addSuccessMessages(successMessages);
messages.addErrorMessages(errorMessages);
} catch (Exception exception) {
@@ -243,8 +241,7 @@ public RedirectView bulkDeleteIssuedCertificates(@RequestParam final List errorMessages = new ArrayList<>();
try {
- this.certificatePageService.bulkDeleteCertificates(ids, successMessages,
- errorMessages);
+ certificatePageService.bulkDeleteCertificates(ids, successMessages, errorMessages);
messages.addSuccessMessages(successMessages);
messages.addErrorMessages(errorMessages);
} catch (Exception exception) {
@@ -295,12 +292,12 @@ private FilteredRecordsList getFilteredIssuedCerti
// if no value has been entered in the global search textbox and in the column search dropdown
if (StringUtils.isBlank(globalSearchTerm) && columnsWithSearchCriteria.isEmpty()) {
- pagedResult = this.issuedAttestationCertificateService.
- findIssuedCertificatesByArchiveFlag(false, pageable);
+ pagedResult =
+ issuedAttestationCertificateService.findIssuedCertificatesByArchiveFlag(false, pageable);
} else if (!StringUtils.isBlank(globalSearchTerm) && !columnsWithSearchCriteria.isEmpty()) {
// if a value has been entered in both the global search textbox and in the column search dropdown
pagedResult =
- this.certificatePageService.findCertificatesByGlobalAndColumnSpecificSearchTerm(
+ certificatePageService.findCertificatesByGlobalAndColumnSpecificSearchTerm(
IssuedAttestationCertificate.class,
searchableColumnNames,
globalSearchTerm,
@@ -310,14 +307,14 @@ private FilteredRecordsList getFilteredIssuedCerti
} else if (!columnsWithSearchCriteria.isEmpty()) {
// if a value has been entered ONLY in the column search dropdown
pagedResult =
- this.certificatePageService.findCertificatesByColumnSpecificSearchTermAndArchiveFlag(
+ certificatePageService.findCertificatesByColumnSpecificSearchTermAndArchiveFlag(
IssuedAttestationCertificate.class,
columnsWithSearchCriteria,
false,
pageable);
} else {
// if a value has been entered ONLY in the global search textbox
- pagedResult = this.certificatePageService.findCertificatesByGlobalSearchTermAndArchiveFlag(
+ pagedResult = certificatePageService.findCertificatesByGlobalSearchTermAndArchiveFlag(
IssuedAttestationCertificate.class,
searchableColumnNames,
globalSearchTerm,
@@ -334,7 +331,7 @@ private FilteredRecordsList getFilteredIssuedCerti
issuedCertificateFilteredRecordsList.setRecordsFiltered(pagedResult.getTotalElements());
issuedCertificateFilteredRecordsList.setRecordsTotal(
- this.issuedAttestationCertificateService.findIssuedCertificateRepoCount());
+ issuedAttestationCertificateService.findIssuedCertificateRepoCount());
return issuedCertificateFilteredRecordsList;
}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/PlatformCredentialPageController.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/PlatformCredentialPageController.java
index d85eb4be1..92373441c 100644
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/PlatformCredentialPageController.java
+++ b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/PlatformCredentialPageController.java
@@ -48,9 +48,9 @@
/**
* Controller for the Platform Credentials page.
*/
-@Log4j2
@Controller
@RequestMapping("/HIRS_AttestationCAPortal/portal/certificate-request/platform-credentials")
+@Log4j2
public class PlatformCredentialPageController extends PageController {
private final CertificatePageService certificatePageService;
private final PlatformCredentialPageService platformCredentialService;
@@ -127,7 +127,7 @@ public DataTableResponse getPlatformCredentialsTableData(
// loop all the platform credentials
for (PlatformCredential pc : pcFilteredRecordsList) {
// find the EC using the PC's "holder serial number"
- EndorsementCredential associatedEC = this.platformCredentialService
+ EndorsementCredential associatedEC = platformCredentialService
.findECBySerialNumber(pc.getHolderSerialNumber());
if (associatedEC != null) {
@@ -158,7 +158,7 @@ public void downloadPlatformCredential(@RequestParam final String id, final Http
try {
final DownloadFile downloadFile =
- this.certificatePageService.downloadCertificate(PlatformCredential.class,
+ certificatePageService.downloadCertificate(PlatformCredential.class,
UUID.fromString(id));
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;" + downloadFile.getFileName());
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
@@ -188,7 +188,7 @@ public void bulkDownloadPlatformCredentials(final HttpServletResponse response)
response.setContentType("application/zip");
try (ZipOutputStream zipOut = new ZipOutputStream(response.getOutputStream())) {
- this.certificatePageService.bulkDownloadCertificates(zipOut, CertificateType.PLATFORM_CREDENTIALS,
+ certificatePageService.bulkDownloadCertificates(zipOut, CertificateType.PLATFORM_CREDENTIALS,
singleFileName);
} catch (Exception exception) {
log.error("An exception was thrown while attempting to bulk download all the"
@@ -219,7 +219,7 @@ protected RedirectView uploadPlatformCredentials(
List successMessages = new ArrayList<>();
PlatformCredential parsedPlatformCredential =
- this.platformCredentialService.parsePlatformCredential(file,
+ platformCredentialService.parsePlatformCredential(file,
errorMessages);
if (parsedPlatformCredential != null) {
@@ -259,7 +259,7 @@ public RedirectView deletePlatformCredential(@RequestParam final String id,
List errorMessages = new ArrayList<>();
try {
- this.certificatePageService.deleteCertificate(UUID.fromString(id),
+ certificatePageService.deleteCertificate(UUID.fromString(id),
successMessages, errorMessages);
messages.addSuccessMessages(successMessages);
@@ -296,7 +296,7 @@ public RedirectView bulkDeletePlatformCertificates(@RequestParam final List errorMessages = new ArrayList<>();
try {
- this.certificatePageService.bulkDeleteCertificates(ids, successMessages,
+ certificatePageService.bulkDeleteCertificates(ids, successMessages,
errorMessages);
messages.addSuccessMessages(successMessages);
messages.addErrorMessages(errorMessages);
@@ -348,29 +348,26 @@ private FilteredRecordsList getFilteredPlatformCredentialLis
// if no value has been entered in the global search textbox and in the column search dropdown
if (StringUtils.isBlank(globalSearchTerm) && columnsWithSearchCriteria.isEmpty()) {
- pagedResult =
- this.platformCredentialService.findPlatformCredentialsByArchiveFlag(false, pageable);
+ pagedResult = platformCredentialService.findPlatformCredentialsByArchiveFlag(false, pageable);
} else if (!StringUtils.isBlank(globalSearchTerm) && !columnsWithSearchCriteria.isEmpty()) {
// if a value has been entered in both the global search textbox and in the column search dropdown
- pagedResult =
- this.certificatePageService.findCertificatesByGlobalAndColumnSpecificSearchTerm(
- PlatformCredential.class,
- searchableColumnNames,
- globalSearchTerm,
- columnsWithSearchCriteria,
- false,
- pageable);
+ pagedResult = certificatePageService.findCertificatesByGlobalAndColumnSpecificSearchTerm(
+ PlatformCredential.class,
+ searchableColumnNames,
+ globalSearchTerm,
+ columnsWithSearchCriteria,
+ false,
+ pageable);
} else if (!columnsWithSearchCriteria.isEmpty()) {
// if a value has been entered ONLY in the column search dropdown
- pagedResult =
- this.certificatePageService.findCertificatesByColumnSpecificSearchTermAndArchiveFlag(
- PlatformCredential.class,
- columnsWithSearchCriteria,
- false,
- pageable);
+ pagedResult = certificatePageService.findCertificatesByColumnSpecificSearchTermAndArchiveFlag(
+ PlatformCredential.class,
+ columnsWithSearchCriteria,
+ false,
+ pageable);
} else {
// if a value has been entered ONLY in the global search textbox
- pagedResult = this.certificatePageService.findCertificatesByGlobalSearchTermAndArchiveFlag(
+ pagedResult = certificatePageService.findCertificatesByGlobalSearchTermAndArchiveFlag(
PlatformCredential.class,
searchableColumnNames,
globalSearchTerm,
@@ -384,8 +381,7 @@ private FilteredRecordsList getFilteredPlatformCredentialLis
}
pcFilteredRecordsList.setRecordsFiltered(pagedResult.getTotalElements());
- pcFilteredRecordsList.setRecordsTotal(
- this.platformCredentialService.findPlatformCredentialRepositoryCount());
+ pcFilteredRecordsList.setRecordsTotal(platformCredentialService.findPlatformCredentialRepositoryCount());
return pcFilteredRecordsList;
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/PolicyPageController.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/PolicyPageController.java
index fa950e35b..afeed1758 100644
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/PolicyPageController.java
+++ b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/PolicyPageController.java
@@ -25,9 +25,9 @@
/**
* Controller for the Policy page.
*/
-@Log4j2
@Controller
@RequestMapping("/HIRS_AttestationCAPortal/portal/policy")
+@Log4j2
public class PolicyPageController extends PageController {
/**
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/ReferenceManifestDetailsPageController.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/ReferenceManifestDetailsPageController.java
index 6b3d03a28..337f3735c 100644
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/ReferenceManifestDetailsPageController.java
+++ b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/ReferenceManifestDetailsPageController.java
@@ -18,9 +18,9 @@
/**
* Controller for the Reference Manifest Details Page.
*/
-@Log4j2
@Controller
@RequestMapping("/HIRS_AttestationCAPortal/portal/rim-details")
+@Log4j2
public class ReferenceManifestDetailsPageController extends PageController {
private final ReferenceManifestDetailsPageService referenceManifestDetailsPageService;
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/ReferenceManifestPageController.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/ReferenceManifestPageController.java
index 15b6785da..0276ed760 100644
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/ReferenceManifestPageController.java
+++ b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/ReferenceManifestPageController.java
@@ -49,9 +49,9 @@
/**
* Controller for the Reference Manifest Page.
*/
-@Log4j2
@Controller
@RequestMapping("/HIRS_AttestationCAPortal/portal/reference-manifests")
+@Log4j2
public class ReferenceManifestPageController extends PageController {
private static final String BASE_RIM_FILE_PATTERN = "(\\S+(\\.(?i)swidtag)$)";
@@ -167,12 +167,12 @@ protected RedirectView uploadRIMs(@RequestParam("file") final MultipartFile[] fi
if (isBaseRim) {
final BaseReferenceManifest baseReferenceManifest =
- this.referenceManifestPageService.parseBaseRIM(errorMessages, file);
+ referenceManifestPageService.parseBaseRIM(errorMessages, file);
baseRims.add(baseReferenceManifest);
messages.addErrorMessages(errorMessages);
} else if (isSupportRim) {
final SupportReferenceManifest supportReferenceManifest =
- this.referenceManifestPageService.parseSupportRIM(errorMessages, file);
+ referenceManifestPageService.parseSupportRIM(errorMessages, file);
supportRims.add(supportReferenceManifest);
messages.addErrorMessages(errorMessages);
} else {
@@ -185,7 +185,7 @@ protected RedirectView uploadRIMs(@RequestParam("file") final MultipartFile[] fi
}
}
- this.referenceManifestPageService.storeRIMS(successMessages, baseRims, supportRims);
+ referenceManifestPageService.storeRIMS(successMessages, baseRims, supportRims);
messages.addSuccessMessages(successMessages);
@@ -207,13 +207,11 @@ public void downloadRIM(@RequestParam final String id, final HttpServletResponse
log.info("Received request to download RIM id {}", id);
try {
- final DownloadFile downloadFile =
- this.referenceManifestPageService.downloadRIM(UUID.fromString(id));
+ final DownloadFile downloadFile = referenceManifestPageService.downloadRIM(UUID.fromString(id));
response.setHeader(HttpHeaders.CONTENT_DISPOSITION,
"attachment;" + "filename=\"" + downloadFile.getFileName());
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
response.getOutputStream().write(downloadFile.getFileBytes());
-
} catch (Exception exception) {
log.error("An exception was thrown while attempting to download the "
+ " specified RIM", exception);
@@ -237,7 +235,7 @@ public void bulkDownloadRIMs(final HttpServletResponse response) throws IOExcept
response.setContentType("application/zip");
try (ZipOutputStream zipOut = new ZipOutputStream(response.getOutputStream())) {
- this.referenceManifestPageService.bulkDownloadRIMS(zipOut);
+ referenceManifestPageService.bulkDownloadRIMS(zipOut);
} catch (Exception exception) {
log.error("An exception was thrown while attempting to bulk download all the "
+ "reference integrity manifests", exception);
@@ -266,7 +264,7 @@ public RedirectView deleteRIM(@RequestParam final String id, final RedirectAttri
List errorMessages = new ArrayList<>();
try {
- this.referenceManifestPageService.deleteRIM(UUID.fromString(id), successMessages, errorMessages);
+ referenceManifestPageService.deleteRIM(UUID.fromString(id), successMessages, errorMessages);
messages.addSuccessMessages(successMessages);
messages.addErrorMessages(errorMessages);
} catch (Exception exception) {
@@ -301,8 +299,7 @@ public RedirectView bulkDeleteRIMs(@RequestParam final List ids,
List errorMessages = new ArrayList<>();
try {
- this.referenceManifestPageService.bulkDeleteRIMs(ids, successMessages,
- errorMessages);
+ referenceManifestPageService.bulkDeleteRIMs(ids, successMessages, errorMessages);
messages.addSuccessMessages(successMessages);
messages.addErrorMessages(errorMessages);
} catch (Exception exception) {
@@ -353,31 +350,27 @@ private FilteredRecordsList getFilteredReferenceManifestList(
// if no value has been entered in the global search textbox and in the column search dropdown
if (StringUtils.isBlank(globalSearchTerm) && columnsWithSearchCriteria.isEmpty()) {
- pagedResult = this.referenceManifestPageService.findAllBaseAndSupportRIMSByPageable(pageable);
+ pagedResult = referenceManifestPageService.findAllBaseAndSupportRIMS(pageable);
} else if (!StringUtils.isBlank(globalSearchTerm) && !columnsWithSearchCriteria.isEmpty()) {
// if a value has been entered in both the global search textbox and in the column search dropdown
- pagedResult =
- this.referenceManifestPageService.findRIMSByGlobalAndColumnSpecificSearchTerm(
- searchableColumnNames,
- globalSearchTerm,
- columnsWithSearchCriteria,
- false,
- pageable);
+ pagedResult = referenceManifestPageService.findRIMSByGlobalAndColumnSpecificSearchTerm(
+ searchableColumnNames,
+ globalSearchTerm,
+ columnsWithSearchCriteria,
+ false,
+ pageable);
} else if (!columnsWithSearchCriteria.isEmpty()) {
// if a value has been entered ONLY in the column search dropdown
- pagedResult =
- this.referenceManifestPageService.
- findRIMSByColumnSpecificSearchTermAndArchiveFlag(
- columnsWithSearchCriteria,
- false,
- pageable);
+ pagedResult = referenceManifestPageService.findRIMSByColumnSpecificSearchTermAndArchiveFlag(
+ columnsWithSearchCriteria,
+ false,
+ pageable);
} else {
// if a value has been entered ONLY in the global search textbox
- pagedResult = this.referenceManifestPageService.
- findRIMSByGlobalSearchTermAndArchiveFlag(searchableColumnNames,
- globalSearchTerm,
- false,
- pageable);
+ pagedResult = referenceManifestPageService.findRIMSByGlobalSearchTermAndArchiveFlag(searchableColumnNames,
+ globalSearchTerm,
+ false,
+ pageable);
}
FilteredRecordsList rimFilteredRecordsList = new FilteredRecordsList<>();
@@ -387,7 +380,7 @@ private FilteredRecordsList getFilteredReferenceManifestList(
}
rimFilteredRecordsList.setRecordsFiltered(pagedResult.getTotalElements());
- rimFilteredRecordsList.setRecordsTotal(this.referenceManifestPageService.findRIMRepositoryCount());
+ rimFilteredRecordsList.setRecordsTotal(referenceManifestPageService.findRIMRepositoryCount());
return rimFilteredRecordsList;
}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/RimDatabasePageController.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/RimDatabasePageController.java
index 63a1a6154..a318e0ba6 100644
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/RimDatabasePageController.java
+++ b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/RimDatabasePageController.java
@@ -31,9 +31,9 @@
/**
* Controller for the TPM Events page.
*/
-@Log4j2
@Controller
@RequestMapping("/HIRS_AttestationCAPortal/portal/rim-database")
+@Log4j2
public class RimDatabasePageController extends PageController {
private final ReferenceDigestValuePageService referenceDigestValuePageService;
@@ -108,12 +108,12 @@ public DataTableResponse getRDVTableData(
for (ReferenceDigestValue rdv : rdvFilteredRecordsList) {
// We are updating the base rim ID field if necessary and
if (rdv.getBaseRimId() == null
- && this.referenceDigestValuePageService.doesRIMExist(rdv.getSupportRimId())) {
- support = (SupportReferenceManifest) this.referenceDigestValuePageService.findRIMById(
+ && referenceDigestValuePageService.doesRIMExist(rdv.getSupportRimId())) {
+ support = (SupportReferenceManifest) referenceDigestValuePageService.findRIMById(
rdv.getSupportRimId());
rdv.setBaseRimId(support.getAssociatedRim());
try {
- this.referenceDigestValuePageService.saveReferenceDigestValue(rdv);
+ referenceDigestValuePageService.saveReferenceDigestValue(rdv);
} catch (DBManagerException dbMEx) {
log.error("Failed to update TPM Event with Base RIM ID");
}
@@ -162,23 +162,21 @@ private FilteredRecordsList getFilteredRDVList(
// if no value has been entered in the global search textbox and in the column search dropdown
if (StringUtils.isBlank(globalSearchTerm) && columnsWithSearchCriteria.isEmpty()) {
- pagedResult = this.referenceDigestValuePageService.findAllReferenceDigestValues(pageable);
+ pagedResult = referenceDigestValuePageService.findAllReferenceDigestValues(pageable);
} else if (!StringUtils.isBlank(globalSearchTerm) && !columnsWithSearchCriteria.isEmpty()) {
// if a value has been entered in both the global search textbox and in the column search dropdown
- pagedResult =
- this.referenceDigestValuePageService.findReferenceDigestValuesByGlobalAndColumnSpecificSearchTerm(
- searchableColumnNames,
- globalSearchTerm,
- columnsWithSearchCriteria,
- pageable);
+ pagedResult = referenceDigestValuePageService.findReferenceDigestValuesByGlobalAndColumnSpecificSearchTerm(
+ searchableColumnNames,
+ globalSearchTerm,
+ columnsWithSearchCriteria,
+ pageable);
} else if (!columnsWithSearchCriteria.isEmpty()) {
// if a value has been entered ONLY in the column search dropdown
- pagedResult =
- this.referenceDigestValuePageService.findReferenceDigestValuesByColumnSpecificSearchTerm(
- columnsWithSearchCriteria, pageable);
+ pagedResult = referenceDigestValuePageService.findReferenceDigestValuesByColumnSpecificSearchTerm(
+ columnsWithSearchCriteria, pageable);
} else {
// if a value has been entered ONLY in the global search textbox
- pagedResult = this.referenceDigestValuePageService.findReferenceDigestValuesByGlobalSearchTerm(
+ pagedResult = referenceDigestValuePageService.findReferenceDigestValuesByGlobalSearchTerm(
searchableColumnNames,
globalSearchTerm, pageable);
}
@@ -191,7 +189,7 @@ private FilteredRecordsList getFilteredRDVList(
rdvFilteredRecordsList.setRecordsFiltered(pagedResult.getTotalElements());
rdvFilteredRecordsList.setRecordsTotal(
- this.referenceDigestValuePageService.findReferenceDigestValueRepositoryCount());
+ referenceDigestValuePageService.findReferenceDigestValueRepositoryCount());
return rdvFilteredRecordsList;
}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/TrustChainCertificatePageController.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/TrustChainCertificatePageController.java
index 96f54d8b6..638b86597 100644
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/TrustChainCertificatePageController.java
+++ b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/TrustChainCertificatePageController.java
@@ -55,9 +55,9 @@
/**
* Controller for the Trust Chain Certificates page.
*/
-@Log4j2
@Controller
@RequestMapping("/HIRS_AttestationCAPortal/portal/certificate-request/trust-chain")
+@Log4j2
public class TrustChainCertificatePageController extends PageController {
/**
* Model attribute name used by initPage for the Root ACA Trust Chain Certificate.
@@ -139,24 +139,24 @@ public ModelAndView initPage(final NoPageParams params, final Model model) {
// add object that contains the leaf ACA certificate information
mav.addObject(LEAF_ACA_CERT_DATA, new HashMap<>(CertificateStringMapBuilder.getCertificateAuthorityInfoHelper(
- this.certificateRepository,
- this.caCredentialRepository,
- this.acaTrustChainCertificates[0],
+ certificateRepository,
+ caCredentialRepository,
+ acaTrustChainCertificates[0],
"Leaf ACA Certificate Not Found")));
// add object that contains the intermediate ACA certificate information
mav.addObject(INTERMEDIATE_ACA_CERT_DATA,
new HashMap<>(CertificateStringMapBuilder.getCertificateAuthorityInfoHelper(
- this.certificateRepository,
- this.caCredentialRepository,
- this.acaTrustChainCertificates[1],
+ certificateRepository,
+ caCredentialRepository,
+ acaTrustChainCertificates[1],
"Intermediate ACA Certificate Not Found")));
// add object that contains the root ACA certificate information
mav.addObject(ROOT_ACA_CERT_DATA, new HashMap<>(CertificateStringMapBuilder.getCertificateAuthorityInfoHelper(
- this.certificateRepository,
- this.caCredentialRepository,
- this.acaTrustChainCertificates[2],
+ certificateRepository,
+ caCredentialRepository,
+ acaTrustChainCertificates[2],
"Root ACA Certificate Not Found")));
return mav;
@@ -226,7 +226,7 @@ public void downloadTrustChainCertificate(@RequestParam final String id,
try {
final DownloadFile downloadFile =
- this.certificatePageService.downloadCertificate(CertificateAuthorityCredential.class,
+ certificatePageService.downloadCertificate(CertificateAuthorityCredential.class,
UUID.fromString(id));
response.setHeader(HttpHeaders.CONTENT_DISPOSITION, "attachment;" + downloadFile.getFileName());
response.setContentType(MediaType.APPLICATION_OCTET_STREAM_VALUE);
@@ -253,8 +253,7 @@ public void downloadACATrustChain(final HttpServletResponse response) throws IOE
// Get the output stream of the response
try (OutputStream outputStream = response.getOutputStream()) {
// PEM file of the leaf certificate, intermediate certificate and root certificate (in that order)
- final String fullChainPEM =
- ControllerPagesUtils.convertCertificateArrayToPem(acaTrustChainCertificates);
+ final String fullChainPEM = ControllerPagesUtils.convertCertificateArrayToPem(acaTrustChainCertificates);
final String pemFileName = "hirs-aca-trust_chain.pem";
@@ -288,7 +287,7 @@ public void bulkDownloadTrustChainCertificates(final HttpServletResponse respons
response.setContentType("application/zip");
try (ZipOutputStream zipOut = new ZipOutputStream(response.getOutputStream())) {
- this.certificatePageService.bulkDownloadCertificates(zipOut, CertificateType.TRUST_CHAIN,
+ certificatePageService.bulkDownloadCertificates(zipOut, CertificateType.TRUST_CHAIN,
singleFileName);
} catch (Exception exception) {
log.error("An exception was thrown while attempting to bulk download all the "
@@ -321,8 +320,7 @@ protected RedirectView uploadTrustChainCertificate(@RequestParam("file") final M
List successMessages = new ArrayList<>();
CertificateAuthorityCredential parsedTrustChainCertificate =
- this.certificatePageService.parseTrustChainCertificate(file, successMessages,
- errorMessages);
+ certificatePageService.parseTrustChainCertificate(file, successMessages, errorMessages);
if (parsedTrustChainCertificate != null) {
certificatePageService.storeCertificate(
@@ -361,8 +359,7 @@ public RedirectView deleteTrustChainCertificate(@RequestParam final String id,
List errorMessages = new ArrayList<>();
try {
- this.certificatePageService.deleteCertificate(UUID.fromString(id), successMessages,
- errorMessages);
+ certificatePageService.deleteCertificate(UUID.fromString(id), successMessages, errorMessages);
messages.addSuccessMessages(successMessages);
messages.addErrorMessages(errorMessages);
} catch (Exception exception) {
@@ -397,8 +394,7 @@ public RedirectView bulkDeleteTrustChainCertificates(@RequestParam final List errorMessages = new ArrayList<>();
try {
- this.certificatePageService.bulkDeleteCertificates(ids, successMessages,
- errorMessages);
+ certificatePageService.bulkDeleteCertificates(ids, successMessages, errorMessages);
messages.addSuccessMessages(successMessages);
messages.addErrorMessages(errorMessages);
} catch (Exception exception) {
@@ -449,30 +445,26 @@ private FilteredRecordsList getFilteredTrustChai
// if no value has been entered in the global search textbox and in the column search dropdown
if (StringUtils.isBlank(globalSearchTerm) && columnsWithSearchCriteria.isEmpty()) {
- pagedResult =
- this.trustChainCertificatePageService.
- findCACredentialsByArchiveFlag(false, pageable);
+ pagedResult = trustChainCertificatePageService.findCACredentialsByArchiveFlag(false, pageable);
} else if (!StringUtils.isBlank(globalSearchTerm) && !columnsWithSearchCriteria.isEmpty()) {
// if a value has been entered in both the global search textbox and in the column search dropdown
- pagedResult =
- this.certificatePageService.findCertificatesByGlobalAndColumnSpecificSearchTerm(
- CertificateAuthorityCredential.class,
- searchableColumnNames,
- globalSearchTerm,
- columnsWithSearchCriteria,
- false,
- pageable);
+ pagedResult = certificatePageService.findCertificatesByGlobalAndColumnSpecificSearchTerm(
+ CertificateAuthorityCredential.class,
+ searchableColumnNames,
+ globalSearchTerm,
+ columnsWithSearchCriteria,
+ false,
+ pageable);
} else if (!columnsWithSearchCriteria.isEmpty()) {
// if a value has been entered ONLY in the column search dropdown
- pagedResult =
- this.certificatePageService.findCertificatesByColumnSpecificSearchTermAndArchiveFlag(
- CertificateAuthorityCredential.class,
- columnsWithSearchCriteria,
- false,
- pageable);
+ pagedResult = certificatePageService.findCertificatesByColumnSpecificSearchTermAndArchiveFlag(
+ CertificateAuthorityCredential.class,
+ columnsWithSearchCriteria,
+ false,
+ pageable);
} else {
- pagedResult = this.certificatePageService.findCertificatesByGlobalSearchTermAndArchiveFlag(
- // if a value has been entered ONLY in the global search textbox
+ // if a value has been entered ONLY in the global search textbox
+ pagedResult = certificatePageService.findCertificatesByGlobalSearchTermAndArchiveFlag(
CertificateAuthorityCredential.class,
searchableColumnNames,
globalSearchTerm,
@@ -487,8 +479,7 @@ private FilteredRecordsList getFilteredTrustChai
}
caFilteredRecordsList.setRecordsFiltered(pagedResult.getTotalElements());
- caFilteredRecordsList.setRecordsTotal(
- this.trustChainCertificatePageService.findTrustChainCertificateRepoCount());
+ caFilteredRecordsList.setRecordsTotal(trustChainCertificatePageService.findTrustChainCertificateRepoCount());
return caFilteredRecordsList;
}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/ValidationReportsPageController.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/ValidationReportsPageController.java
index 8a8c6d43a..dbe7e48d6 100644
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/ValidationReportsPageController.java
+++ b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/controllers/ValidationReportsPageController.java
@@ -32,9 +32,9 @@
/**
* Controller for the Validation Summary Reports page.
*/
-@Log4j2
@Controller
@RequestMapping("/HIRS_AttestationCAPortal/portal/validation-reports")
+@Log4j2
public class ValidationReportsPageController extends PageController {
private final ValidationSummaryPageService validationSummaryPageService;
@@ -122,7 +122,7 @@ public void downloadValidationReports(final HttpServletRequest request,
final HttpServletResponse response)
throws IOException {
log.info("Received request to download validation summary reports");
- this.validationSummaryPageService.downloadValidationReports(request, response);
+ validationSummaryPageService.downloadValidationReports(request, response);
}
/**
@@ -162,11 +162,11 @@ private FilteredRecordsList getFilteredValidationS
// if no value has been entered in the global search textbox and in the column search dropdown
if (StringUtils.isBlank(globalSearchTerm) && columnsWithSearchCriteria.isEmpty()) {
- pagedResult = this.validationSummaryPageService.findValidationSummaryReportsByPageable(pageable);
+ pagedResult = validationSummaryPageService.findValidationSummaryReportsByPageable(pageable);
} else if (!StringUtils.isBlank(globalSearchTerm) && !columnsWithSearchCriteria.isEmpty()) {
// if a value has been entered in both the global search textbox and in the column search dropdown
pagedResult =
- this.validationSummaryPageService.findValidationSummaryReportsByGlobalAndColumnSpecificSearchTerm(
+ validationSummaryPageService.findValidationSummaryReportsByGlobalAndColumnSpecificSearchTerm(
searchableColumnNames,
globalSearchTerm,
columnsWithSearchCriteria,
@@ -174,17 +174,16 @@ private FilteredRecordsList getFilteredValidationS
pageable);
} else if (!columnsWithSearchCriteria.isEmpty()) {
// if a value has been entered ONLY in the column search dropdown
- pagedResult = this.validationSummaryPageService
- .findValidationSummaryReportsByColumnSpecificSearchTermAndArchiveFlag(
+ pagedResult =
+ validationSummaryPageService.findValidationSummaryReportsByColumnSpecificSearchTermAndArchiveFlag(
columnsWithSearchCriteria, false, pageable);
} else {
// if a value has been entered ONLY in the global search textbox
- pagedResult = this.validationSummaryPageService
- .findValidationReportsByGlobalSearchTermAndArchiveFlag(
- searchableColumnNames,
- globalSearchTerm,
- false,
- pageable);
+ pagedResult = validationSummaryPageService.findValidationReportsByGlobalSearchTermAndArchiveFlag(
+ searchableColumnNames,
+ globalSearchTerm,
+ false,
+ pageable);
}
FilteredRecordsList reportsFilteredRecordsList =
@@ -195,8 +194,7 @@ private FilteredRecordsList getFilteredValidationS
}
reportsFilteredRecordsList.setRecordsFiltered(pagedResult.getTotalElements());
- reportsFilteredRecordsList.setRecordsTotal(
- this.validationSummaryPageService.findValidationSummaryRepositoryCount());
+ reportsFilteredRecordsList.setRecordsTotal(validationSummaryPageService.findValidationSummaryRepositoryCount());
return reportsFilteredRecordsList;
}
diff --git a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/utils/ControllerPagesUtils.java b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/utils/ControllerPagesUtils.java
index 97c8de64e..bfde10df2 100644
--- a/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/utils/ControllerPagesUtils.java
+++ b/HIRS_AttestationCAPortal/src/main/java/hirs/attestationca/portal/page/utils/ControllerPagesUtils.java
@@ -65,8 +65,12 @@ public static Pageable createPageableObject(final int pageStart,
return PageRequest.of(currentPage, pageSize, sort);
}
- // Create the Pageable object without sorting if no order column is provided
- return PageRequest.of(currentPage, pageSize);
+ final String defaultSortColumnName = "createTime";
+ Sort defaultSort = Sort.by(new Sort.Order(Sort.Direction.DESC, defaultSortColumnName));
+
+ // Create the Pageable object using the default sorting (which is sorting the table based on the creation
+ // time ), if no order column is provided
+ return PageRequest.of(currentPage, pageSize, defaultSort);
}
/**
diff --git a/HIRS_AttestationCAPortal/src/main/resources/templates/validation-reports.html b/HIRS_AttestationCAPortal/src/main/resources/templates/validation-reports.html
index 81b4a5968..23def61a9 100644
--- a/HIRS_AttestationCAPortal/src/main/resources/templates/validation-reports.html
+++ b/HIRS_AttestationCAPortal/src/main/resources/templates/validation-reports.html
@@ -112,8 +112,6 @@
//Set data tables
let dataTable = setDataTables(viewName, "#reportTable", url, columns);
- dataTable.order([1, "desc"]).draw(); //order by createTime
-
$("#download").submit(function (e) {
let tableLength = $("#reportTable").rows;
let createTimes = "";