diff options
Diffstat (limited to 'src/main/java/at/gv/egiz/moazs/util')
-rw-r--r-- | src/main/java/at/gv/egiz/moazs/util/StoreSOAPBodyBinaryInRepositoryInterceptor.java | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/src/main/java/at/gv/egiz/moazs/util/StoreSOAPBodyBinaryInRepositoryInterceptor.java b/src/main/java/at/gv/egiz/moazs/util/StoreSOAPBodyBinaryInRepositoryInterceptor.java index d70c8bd..39566fe 100644 --- a/src/main/java/at/gv/egiz/moazs/util/StoreSOAPBodyBinaryInRepositoryInterceptor.java +++ b/src/main/java/at/gv/egiz/moazs/util/StoreSOAPBodyBinaryInRepositoryInterceptor.java @@ -16,6 +16,7 @@ import javax.xml.parsers.ParserConfigurationException; import java.io.IOException; import java.nio.charset.StandardCharsets; import java.util.Map; +import java.util.function.Function; import static at.gv.egiz.moazs.MoaZSException.moaZSException; @@ -26,16 +27,17 @@ public class StoreSOAPBodyBinaryInRepositoryInterceptor extends AbstractPhaseInt private final CXFMessageUtils messageUtils; private final SOAPUtils soapUtils; - private final Map<String, String> idSuffixes; + private final Map<String, Function<String, String>> idGenerators; private final BinaryRepository repository; @Autowired public StoreSOAPBodyBinaryInRepositoryInterceptor(CXFMessageUtils extractor, SOAPUtils soapUtils, - Map<String, String> idSuffixes, BinaryRepository repository) { + Map<String, Function<String, String>> idGenerators, + BinaryRepository repository) { super(Phase.RECEIVE); this.messageUtils = extractor; this.soapUtils = soapUtils; - this.idSuffixes = idSuffixes; + this.idGenerators = idGenerators; this.repository = repository; } @@ -57,12 +59,12 @@ public class StoreSOAPBodyBinaryInRepositoryInterceptor extends AbstractPhaseInt String appDeliveryID = soapUtils.getAppDeliveryIDFrom(document); String rootTag = document.getTagName(); - if (!idSuffixes.containsKey(rootTag)) { + if (!idGenerators.containsKey(rootTag)) { log.trace("Will not add message of type {}. ", rootTag); return; } - var id = appDeliveryID + idSuffixes.get(rootTag); + var id = idGenerators.get(rootTag).apply(appDeliveryID); repository.add(id, response); if(log.isTraceEnabled()) { |