From eb734ff3c6f95d9611e4da1d8022ba60324773aa Mon Sep 17 00:00:00 2001 From: Simon Laurenz Date: Mon, 8 Nov 2021 15:40:35 +0100 Subject: [PATCH] Sorted response of booster notification rules --- .../ec/dgc/businessrule/service/DomesticRuleService.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/eu/europa/ec/dgc/businessrule/service/DomesticRuleService.java b/src/main/java/eu/europa/ec/dgc/businessrule/service/DomesticRuleService.java index 2a03fd0..1f167d0 100644 --- a/src/main/java/eu/europa/ec/dgc/businessrule/service/DomesticRuleService.java +++ b/src/main/java/eu/europa/ec/dgc/businessrule/service/DomesticRuleService.java @@ -25,6 +25,7 @@ import eu.europa.ec.dgc.businessrule.model.DomesticRuleItem; import eu.europa.ec.dgc.businessrule.repository.SignedListRepository; import eu.europa.ec.dgc.businessrule.restapi.dto.DomesticRuleListItemDto; +import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -42,7 +43,7 @@ @Service public class DomesticRuleService { - private Map domesticRuleMap = new HashMap<>(); + private final Map domesticRuleMap = new HashMap<>(); private final ListSigningService listSigningService; private final Optional signingService; private final SignedListRepository signedListRepository; @@ -62,7 +63,9 @@ public void domesticRuleServiceInit() { */ public List getRulesList() { - return domesticRuleMap.values().stream().map(rule -> new DomesticRuleListItemDto( + return domesticRuleMap.values().stream() + .sorted(Comparator.comparing(DomesticRuleItem::getIdentifier)) + .map(rule -> new DomesticRuleListItemDto( rule.getIdentifier(), rule.getVersion(), rule.getHash()