From fdc1be87329d41ebbabd19c7e1d63098932d9641 Mon Sep 17 00:00:00 2001 From: Torsten Egenolf Date: Fri, 10 May 2024 17:33:37 +0200 Subject: [PATCH] feat(trustlist-v2): added did for domain and participant --- .../SignerInformationRepository.java | 2 ++ .../service/SignerInformationService.java | 4 ++++ .../service/did/DidTrustListServiceV2.java | 22 +++++++++---------- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/main/java/tng/trustnetwork/keydistribution/repository/SignerInformationRepository.java b/src/main/java/tng/trustnetwork/keydistribution/repository/SignerInformationRepository.java index e082776..170908c 100644 --- a/src/main/java/tng/trustnetwork/keydistribution/repository/SignerInformationRepository.java +++ b/src/main/java/tng/trustnetwork/keydistribution/repository/SignerInformationRepository.java @@ -76,4 +76,6 @@ public interface SignerInformationRepository extends JpaRepository getAllByDeletedIsAndDomainIsAndCountryIs(boolean deleted, String domain, String country); + @Query("SELECT DISTINCT s.country FROM SignerInformationEntity s WHERE s.deleted = false AND s.domain = :domain") + List getParticipantsByDomain(@Param("domain") String domain); } diff --git a/src/main/java/tng/trustnetwork/keydistribution/service/SignerInformationService.java b/src/main/java/tng/trustnetwork/keydistribution/service/SignerInformationService.java index eeb1c20..c126312 100644 --- a/src/main/java/tng/trustnetwork/keydistribution/service/SignerInformationService.java +++ b/src/main/java/tng/trustnetwork/keydistribution/service/SignerInformationService.java @@ -219,4 +219,8 @@ public List getActiveCertificatesForFilter(String domai public List getDomainsList() { return signerInformationRepository.getDomainsList(); } + + public List getParticipantsByDomain(String domain) { + return signerInformationRepository.getParticipantsByDomain(domain); + } } diff --git a/src/main/java/tng/trustnetwork/keydistribution/service/did/DidTrustListServiceV2.java b/src/main/java/tng/trustnetwork/keydistribution/service/did/DidTrustListServiceV2.java index 97fc5cf..7d0d124 100644 --- a/src/main/java/tng/trustnetwork/keydistribution/service/did/DidTrustListServiceV2.java +++ b/src/main/java/tng/trustnetwork/keydistribution/service/did/DidTrustListServiceV2.java @@ -108,17 +108,17 @@ public void job() { log.error("Failed to process DID-TrustList for domain {} : {}", domain, e.getMessage()); } - //TODO: implement get all participants with given domain (see signerInformationService.getCountryList()) -// for (String participant : signerInformationService.getParticipantsByDomain(domain)) { -// String didDocument = null; -// try { -// saveDid(generateContainerPathForDid(domain, participant, null), generateTrustList(domain, participant, null)); -// saveDid(generateContainerPathForDid(domain, participant, DSC), generateTrustList(domain, participant, DSC)); -// saveDid(generateContainerPathForDid(domain, participant, CSCA), generateTrustList(domain, participant, CSCA)); -// } catch (Exception e) { -// log.error("Failed to process DID-TrustList for domain {} : {}", domain, e.getMessage()); -// } -// } + + for (String participant : signerInformationService.getParticipantsByDomain(domain)) { + String didDocument = null; + try { + saveDid(generateContainerPathForDid(domain, participant, null), generateTrustList(domain, participant, null)); + //saveDid(generateContainerPathForDid(domain, participant, DSC), generateTrustList(domain, participant, DSC)); + //saveDid(generateContainerPathForDid(domain, participant, CSCA), generateTrustList(domain, participant, CSCA)); + } catch (Exception e) { + log.error("Failed to process DID-TrustList for domain {} : {}", domain, e.getMessage()); + } + } }