mirror of
https://github.com/nsacyber/HIRS.git
synced 2025-04-08 11:54:27 +00:00
Resolved the issue with the Certificate page not paging. I had the
setters flipped.
This commit is contained in:
parent
751a8104fc
commit
46ecbe6b26
@ -61,9 +61,6 @@ import java.util.UUID;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
|
||||
//import java.security.cert.CertificateEncodingException;
|
||||
//import java.security.cert.X509Certificate;
|
||||
|
||||
// note uploading base64 certs, old or new having decode issues check ACA channel
|
||||
|
||||
/**
|
||||
@ -223,12 +220,6 @@ public class CertificatePageController extends PageController<NoPageParams> {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* Ok I think what I will do is make repositories for each certificate type to I can
|
||||
* tell it what the type T is.
|
||||
*/
|
||||
FilteredRecordsList<Certificate> records = new FilteredRecordsList<>();
|
||||
int currentPage = input.getStart() / input.getLength();
|
||||
Pageable paging = PageRequest.of(currentPage, input.getLength(), Sort.by(orderColumnName));
|
||||
|
||||
@ -239,13 +230,14 @@ public class CertificatePageController extends PageController<NoPageParams> {
|
||||
// records = OrderedListQueryDataTableAdapter.getOrderedList(
|
||||
// getCertificateClass(certificateType), platformCertificateRepository,
|
||||
// input, orderColumnName, criteriaModifier);
|
||||
FilteredRecordsList<PlatformCredential> records = new FilteredRecordsList<>();
|
||||
|
||||
org.springframework.data.domain.Page<PlatformCredential> pagedResult = this.platformCertificateRepository.findAll(paging);
|
||||
if (pagedResult.hasContent()) {
|
||||
records.addAll(pagedResult.getContent());
|
||||
}
|
||||
records.setRecordsFiltered(input.getLength());
|
||||
records.setRecordsTotal(platformCertificateRepository.count());
|
||||
records.setRecordsTotal(input.getLength());
|
||||
records.setRecordsFiltered(platformCertificateRepository.count());
|
||||
EndorsementCredential associatedEC;
|
||||
|
||||
if (!records.isEmpty()) {
|
||||
@ -264,18 +256,53 @@ public class CertificatePageController extends PageController<NoPageParams> {
|
||||
pc.setEndorsementCredential(associatedEC);
|
||||
}
|
||||
}
|
||||
|
||||
log.debug("Returning list of size: " + records.size());
|
||||
return new DataTableResponse<>(records, input);
|
||||
} else if (certificateType.equals(ENDORSEMENTCREDENTIAL)) {
|
||||
records = OrderedListQueryDataTableAdapter.getOrderedList(
|
||||
getCertificateClass(certificateType), endorsementCredentialRepository,
|
||||
input, orderColumnName, criteriaModifier);
|
||||
// records = OrderedListQueryDataTableAdapter.getOrderedList(
|
||||
// getCertificateClass(certificateType), endorsementCredentialRepository,
|
||||
// input, orderColumnName, criteriaModifier);
|
||||
FilteredRecordsList<EndorsementCredential> records = new FilteredRecordsList<>();
|
||||
org.springframework.data.domain.Page<EndorsementCredential> pagedResult = this.endorsementCredentialRepository.findAll(paging);
|
||||
if (pagedResult.hasContent()) {
|
||||
records.addAll(pagedResult.getContent());
|
||||
}
|
||||
|
||||
records.setRecordsTotal(input.getLength());
|
||||
records.setRecordsFiltered(endorsementCredentialRepository.count());
|
||||
|
||||
log.debug("Returning list of size: " + records.size());
|
||||
return new DataTableResponse<>(records, input);
|
||||
} else if (certificateType.equals(TRUSTCHAIN)) {
|
||||
records = OrderedListQueryDataTableAdapter.getOrderedList(
|
||||
getCertificateClass(certificateType), caCredentialRepository,
|
||||
input, orderColumnName, criteriaModifier);
|
||||
// records = OrderedListQueryDataTableAdapter.getOrderedList(
|
||||
// getCertificateClass(certificateType), caCredentialRepository,
|
||||
// input, orderColumnName, criteriaModifier);
|
||||
FilteredRecordsList<CertificateAuthorityCredential> records = new FilteredRecordsList<>();
|
||||
org.springframework.data.domain.Page<CertificateAuthorityCredential> pagedResult = this.caCredentialRepository.findAll(paging);
|
||||
|
||||
if (pagedResult.hasContent()) {
|
||||
records.addAll(pagedResult.getContent());
|
||||
}
|
||||
records.setRecordsTotal(input.getLength());
|
||||
records.setRecordsFiltered(caCredentialRepository.count());
|
||||
|
||||
log.debug("Returning list of size: " + records.size());
|
||||
return new DataTableResponse<>(records, input);
|
||||
} else if (certificateType.equals(ISSUEDCERTIFICATES)) {
|
||||
FilteredRecordsList<IssuedAttestationCertificate> records = new FilteredRecordsList<>();
|
||||
org.springframework.data.domain.Page<IssuedAttestationCertificate> pagedResult = this.issuedCertificateRepository.findAll(paging);
|
||||
if (pagedResult.hasContent()) {
|
||||
records.addAll(pagedResult.getContent());
|
||||
}
|
||||
records.setRecordsTotal(input.getLength());
|
||||
records.setRecordsFiltered(issuedCertificateRepository.count());
|
||||
|
||||
log.debug("Returning list of size: " + records.size());
|
||||
return new DataTableResponse<>(records, input);
|
||||
}
|
||||
|
||||
log.debug("Returning list of size: " + records.size());
|
||||
return new DataTableResponse<>(records, input);
|
||||
return new DataTableResponse<Certificate>(new FilteredRecordsList<>(), input);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -136,6 +136,8 @@ public class ReferenceManifestPageController extends PageController<NoPageParams
|
||||
}
|
||||
};
|
||||
|
||||
log.info("Querying with the following dataTableInput: " + input.toString());
|
||||
|
||||
FilteredRecordsList<ReferenceManifest> records = new FilteredRecordsList<>();
|
||||
int currentPage = input.getStart() / input.getLength();
|
||||
Pageable paging = PageRequest.of(currentPage, input.getLength(), Sort.by(orderColumnName));
|
||||
|
@ -106,7 +106,8 @@ public class RimDatabasePageController extends PageController<NoPageParams> {
|
||||
}
|
||||
};
|
||||
|
||||
log.info("Querying with the following datatableinput: " + input.toString());
|
||||
log.info("Querying with the following dataTableInput: " + input.toString());
|
||||
|
||||
FilteredRecordsList<ReferenceDigestValue> referenceDigestValues = new FilteredRecordsList<>();
|
||||
|
||||
int currentPage = input.getStart() / input.getLength();
|
||||
@ -141,6 +142,7 @@ public class RimDatabasePageController extends PageController<NoPageParams> {
|
||||
}
|
||||
}
|
||||
|
||||
log.debug("Returning list of size: " + referenceDigestValues.size());
|
||||
return new DataTableResponse<>(referenceDigestValues, input);
|
||||
}
|
||||
}
|
||||
|
@ -29,6 +29,9 @@ import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.log4j.Log4j2;
|
||||
import org.hibernate.Session;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
|
Loading…
x
Reference in New Issue
Block a user