Skip to content

Commit

Permalink
Fix getmessageId
Browse files Browse the repository at this point in the history
  • Loading branch information
RettIProd committed Sep 22, 2023
1 parent 21465dc commit e65191e
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions ebms-provider/src/main/kotlin/no/nav/emottak/ebms/model/EbmsExt.kt
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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<MessageHeader>()
.stream().filter { isNotBlank(it.id) }
.map { it.id }.findFirst().get()
}

fun Envelope.getVersion(): String {
return this.header.any.filterIsInstance<MessageHeader>()
.stream().filter { isNotBlank(it.version) }
.map { it.version }.findFirst().get()
}

fun Envelope.getMessageId(): String {
return this.header.any.filterIsInstance<MessageData>()
.stream().filter { isNotBlank(it.messageId) }
.map { it.messageId }.findFirst().get()
}

fun Envelope.getActor(): String {
return this.header.any.filterIsInstance<AckRequested>().stream()
.filter{ isNotBlank(it.actor) }.map { it.actor }.findFirst().get()
Expand Down

0 comments on commit e65191e

Please sign in to comment.