Skip to content

Commit

Permalink
feat(trustlist-v2): adapted trust list entry id gen fixed checkstyle
Browse files Browse the repository at this point in the history
  • Loading branch information
Torsten Egenolf committed May 13, 2024
1 parent 50756a0 commit 5435817
Show file tree
Hide file tree
Showing 4 changed files with 379 additions and 346 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ public interface SignerInformationRepository extends JpaRepository<SignerInforma

List<SignerInformationEntity> getAllByDeletedIsAndDomainIs(boolean deleted, String domain);

List<SignerInformationEntity> getAllByDeletedIsAndDomainIsAndCountryIs(boolean deleted, String domain, String country);
List<SignerInformationEntity> getAllByDeletedIsAndDomainIsAndCountryIs(boolean deleted,
String domain,
String country);


@Query("SELECT DISTINCT s.country FROM SignerInformationEntity s WHERE s.deleted = false AND s.domain = :domain")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ public List<String> getListOfValidKids() {
}

/**
* Method to synchronise the certificates in the db with the given List of trusted certificates.
* Method to synchronise the certificates in the db with the given List
* of trusted certificates.
*
* @param trustedCerts defines the list of trusted certificates.
*/
Expand Down Expand Up @@ -187,6 +188,7 @@ public List<String> getCountryList() {
* @return List of SignerInformationEntity
*/
public List<SignerInformationEntity> getActiveCertificates() {

return signerInformationRepository.getAllByDeletedIs(false);
}

Expand All @@ -197,6 +199,7 @@ public List<SignerInformationEntity> getActiveCertificates() {
* @return List of SignerInformationEntity
*/
public List<SignerInformationEntity> getActiveCertificatesForCountries(List<String> countries) {

return signerInformationRepository.getAllByDeletedIsAndCountryIsIn(false, countries);
}

Expand All @@ -205,22 +208,42 @@ private CertificatesLookupResponseItemDto map(SignerInformationEntity entity) {
return new CertificatesLookupResponseItemDto(entity.getKid(), entity.getRawData());
}

/**
* Returns signer information that are active filtered by domain and participant.
*
* @param domain a domain name used as filter
* @param participant a participant aka country code, used as filter
* @return active signer information
*/
public List<SignerInformationEntity> getActiveCertificatesForFilter(String domain, String participant) {

public List<SignerInformationEntity> getActiveCertificatesForFilter(String domain, String participant){
if (domain != null && participant != null){
if (domain != null && participant != null) {
return signerInformationRepository.getAllByDeletedIsAndDomainIsAndCountryIs(false, domain, participant);
}else if (domain != null){
} else if (domain != null) {
return signerInformationRepository.getAllByDeletedIsAndDomainIs(false, domain);
}else{
} else {
return getActiveCertificates();
}
}

/**
* Returns a list of domains for which certificates are imported.
*
* @return list of domains
*/
public List<String> getDomainsList() {

return signerInformationRepository.getDomainsList();
}

/**
* Returns a list of participants filtered by domain.
*
* @param domain a domain name used as filter
* @return list of participants
*/
public List<String> getParticipantsByDomain(String domain) {

return signerInformationRepository.getParticipantsByDomain(domain);
}
}
Loading

0 comments on commit 5435817

Please sign in to comment.