Skip to content

Commit

Permalink
EbmsAcknowledgment + ebmsmessage tabel
Browse files Browse the repository at this point in the history
Co-authored-by: Alexander Petrov <[email protected]>
Co-authored-by: Chris Olsen <[email protected]>
  • Loading branch information
alpet and RettIProd committed Sep 22, 2023
1 parent 471ce2b commit 74b5702
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,11 @@ fun Envelope.ackRequested() : AckRequested? {
return this.header.any.filterIsInstance<AckRequested>().first()
}

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

fun Envelope.getAckRequestedSigned(): Boolean {
return this.header.any.filterIsInstance<AckRequested>().stream()
.anyMatch { it.isSigned } // Kotlin quirk. Med isSigned menes at en signed Ack er ønsket
fun MessageHeader.getAckRequestedSigned(): Boolean? {
return this.any!!.filterIsInstance<AckRequested>().find { it.isSigned }?.isSigned // Kotlin quirk. Med isSigned menes at en signed Ack er ønsket
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,17 @@ import kotlin.coroutines.Continuation

class AckRequestedProcessor(): Processor {

fun createAcknowledgement(envelope: Envelope): Acknowledgment {
fun createAcknowledgement(message: EbMSMessage): Acknowledgment {
val acknowledgment = Acknowledgment()
acknowledgment.id = "ACK_ID" // Identifier for Acknowledgment elementet, IKKE message ID. // TODO avklar, dette er såvidt jeg vet en arbitrær verdi?
acknowledgment.version = envelope.getVersion()
acknowledgment.version = message.messageHeader.version
acknowledgment.isMustUnderstand = true // Alltid
acknowledgment.actor = envelope.getActor()
acknowledgment.actor = message.messageHeader.getActor()
acknowledgment.timestamp = Date.from(Instant.now()) // TODO dette skal være message received date, hente fra context?
acknowledgment.refToMessageId = envelope.getMessageId()
acknowledgment.from = envelope.getFrom()
if(envelope.getAckRequestedSigned()) {
//@TODO legg til messageID fra messageData
//acknowledgment.refToMessageId = envelope.getMessageId()
acknowledgment.from = message.messageHeader.from
if(message.messageHeader.getAckRequestedSigned() == true) {
// TODO vi må signere responsen, kan kanskje alltid gjøres uansett?
acknowledgment.reference.addAll(getReferences())
}
Expand All @@ -37,7 +38,7 @@ class AckRequestedProcessor(): Processor {
return emptyList() // TODO XMLDSIG elements fra signaturen vår
}

override fun process() {
override fun process(message: EbMSMessage) {
TODO("Not yet implemented")
}
}
Expand Down

0 comments on commit 74b5702

Please sign in to comment.