From e65191e3c7776007c4e055894d7bddac9ef2d61c Mon Sep 17 00:00:00 2001 From: Chris Olsen Date: Fri, 22 Sep 2023 13:41:27 +0200 Subject: [PATCH] Fix getmessageId --- .../kotlin/no/nav/emottak/ebms/model/EbmsExt.kt | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/ebms-provider/src/main/kotlin/no/nav/emottak/ebms/model/EbmsExt.kt b/ebms-provider/src/main/kotlin/no/nav/emottak/ebms/model/EbmsExt.kt index 9f45cc1c..3c725099 100644 --- a/ebms-provider/src/main/kotlin/no/nav/emottak/ebms/model/EbmsExt.kt +++ b/ebms-provider/src/main/kotlin/no/nav/emottak/ebms/model/EbmsExt.kt @@ -1,10 +1,7 @@ package no.nav.emottak.ebms.model import org.apache.commons.lang3.StringUtils.isNotBlank -import org.oasis_open.committees.ebxml_msg.schema.msg_header_2_0.AckRequested -import org.oasis_open.committees.ebxml_msg.schema.msg_header_2_0.From -import org.oasis_open.committees.ebxml_msg.schema.msg_header_2_0.Manifest -import org.oasis_open.committees.ebxml_msg.schema.msg_header_2_0.MessageHeader +import org.oasis_open.committees.ebxml_msg.schema.msg_header_2_0.* import org.xmlsoap.schemas.soap.envelope.Envelope // TODO kan sikkert flytte alt dette til der det brukes. @@ -27,18 +24,18 @@ fun Envelope.getFrom (): From { return (this.header.any.find { it is MessageHeader } as MessageHeader).from } -fun Envelope.getMessageId(): String { - return this.header.any.filterIsInstance() - .stream().filter { isNotBlank(it.id) } - .map { it.id }.findFirst().get() -} - fun Envelope.getVersion(): String { return this.header.any.filterIsInstance() .stream().filter { isNotBlank(it.version) } .map { it.version }.findFirst().get() } +fun Envelope.getMessageId(): String { + return this.header.any.filterIsInstance() + .stream().filter { isNotBlank(it.messageId) } + .map { it.messageId }.findFirst().get() +} + fun Envelope.getActor(): String { return this.header.any.filterIsInstance().stream() .filter{ isNotBlank(it.actor) }.map { it.actor }.findFirst().get()