From cb5a530f785b97e60ac5306416e435bea0bd48f3 Mon Sep 17 00:00:00 2001 From: Moanes Ben Amor Date: Thu, 2 Dec 2021 22:46:42 +0100 Subject: [PATCH] fix: The configuration of string field concatenation was being read incorrectly --- changelog.md | 18 ++++++++++++++++++ pom.xml | 2 +- .../normalization/FieldsNormalization.java | 14 ++++++-------- .../RandomRecordBloomFilterGeneratorTest.java | 1 + 4 files changed, 26 insertions(+), 9 deletions(-) create mode 100644 changelog.md diff --git a/changelog.md b/changelog.md new file mode 100644 index 0000000..ccec41f --- /dev/null +++ b/changelog.md @@ -0,0 +1,18 @@ +# Changelog +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [1.0.3] - 2021-12-02 +### Fixed +- The configuration of string field concatenation was being read incorrectly +## [1.0.2] - 2021-07-06 +### Add +- Allow the configuration of multiple transformations per field +## [1.0.1] - 2021-07-06 +### Changed +- Rename java package +## [1.0.0] - 2021-06-30 +### Added +- Initial release \ No newline at end of file diff --git a/pom.xml b/pom.xml index 4c01778..6e984d9 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 de.pseudonymisierung mainzelliste.client-fttp - 1.0.2-SNAPSHOT + 1.0.3-SNAPSHOT jar mainzelliste.client-fttp diff --git a/src/main/java/de/pseudonymisierung/mainzelliste/client/fttp/normalization/FieldsNormalization.java b/src/main/java/de/pseudonymisierung/mainzelliste/client/fttp/normalization/FieldsNormalization.java index 8cf2531..e8ea715 100644 --- a/src/main/java/de/pseudonymisierung/mainzelliste/client/fttp/normalization/FieldsNormalization.java +++ b/src/main/java/de/pseudonymisierung/mainzelliste/client/fttp/normalization/FieldsNormalization.java @@ -1,6 +1,7 @@ package de.pseudonymisierung.mainzelliste.client.fttp.normalization; import de.pseudonymisierung.mainzelliste.client.fttp.util.PropertiesUtils; +import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -29,17 +30,14 @@ public FieldsNormalization(Properties config) { this.fieldTransformers = PropertiesUtils.getSubProperties(config, "field").entrySet().stream() .collect(Collectors.toMap(Entry::getKey, p -> PropertiesUtils.getSubProperties(p.getValue(), "transformer").values().stream() - .filter( - c -> fieldTransformersSupplier.containsKey(c.getProperty("type", "").trim())) + .filter( c -> fieldTransformersSupplier.containsKey(c.getProperty("type", "").trim())) .map(c -> fieldTransformersSupplier.get(c.getProperty("type")).apply(c)) .collect(Collectors.toList()))); - this.fieldConcatenations = PropertiesUtils.getSubProperties(config, "field").entrySet() - .stream() - .filter(e -> fieldConcatenationsSupplier - .containsKey(e.getValue().getProperty("transformer.type", "").trim())) - .map(e -> fieldConcatenationsSupplier.get(e.getValue().getProperty("transformer.type")) - .apply(e.getKey(), e.getValue())) + this.fieldConcatenations = PropertiesUtils.getSubProperties(config, "field").entrySet().stream() + .flatMap( f -> PropertiesUtils.getSubProperties(f.getValue(), "transformer").values().stream() + .filter( p -> fieldConcatenationsSupplier.containsKey(p.getProperty("type", "").trim())) + .map( p -> fieldConcatenationsSupplier.get(p.getProperty("type")).apply( f.getKey(), p))) .collect(Collectors.toList()); } diff --git a/src/test/java/de/pseudonymisierung/mainzelliste/client/fttp/bloomfilter/RandomRecordBloomFilterGeneratorTest.java b/src/test/java/de/pseudonymisierung/mainzelliste/client/fttp/bloomfilter/RandomRecordBloomFilterGeneratorTest.java index 5dec05e..d5fef21 100644 --- a/src/test/java/de/pseudonymisierung/mainzelliste/client/fttp/bloomfilter/RandomRecordBloomFilterGeneratorTest.java +++ b/src/test/java/de/pseudonymisierung/mainzelliste/client/fttp/bloomfilter/RandomRecordBloomFilterGeneratorTest.java @@ -43,6 +43,7 @@ public void testGenerateBalancedBloomFilter() { //init filed normalization FieldsNormalization fieldsNormalization = new FieldsNormalization(normalizationConfig); + //init bloom filter generator RandomRecordBloomFilterGenerator bloomFilterGenerator = new RandomRecordBloomFilterGenerator(bloomFilterConfig); //prepare idat fields