Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Commit

Permalink
Merge pull request #22 from corona-warn-app/sorting_bnrules
Browse files Browse the repository at this point in the history
Sorted response of booster notification rules
  • Loading branch information
ascheibal authored Nov 8, 2021
2 parents ec0326d + eb734ff commit be3a2bc
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -42,7 +43,7 @@
@Service
public class DomesticRuleService {

private Map<String, DomesticRuleItem> domesticRuleMap = new HashMap<>();
private final Map<String, DomesticRuleItem> domesticRuleMap = new HashMap<>();
private final ListSigningService listSigningService;
private final Optional<SigningService> signingService;
private final SignedListRepository signedListRepository;
Expand All @@ -62,7 +63,9 @@ public void domesticRuleServiceInit() {
*/
public List<DomesticRuleListItemDto> 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()
Expand Down

0 comments on commit be3a2bc

Please sign in to comment.