Skip to content

Commit 0278991

Browse files
committed
hjelpemetode hmsArtNrs for å hente ut alle hmsArtNr for alle hjelpemidler og tilbehør
1 parent b902789 commit 0278991

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

behovsmeldingsmodell/src/main/kotlin/no/nav/hjelpemidler/behovsmeldingsmodell/v2/Innsenderbehovsmelding.kt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,20 @@ data class Hjelpemidler(
127127
val hjelpemidler: List<Hjelpemiddel>,
128128
val tilbehør: List<Tilbehør> = emptyList(),
129129
val totaltAntall: Int,
130-
) : Iterable<Hjelpemiddel> by hjelpemidler
130+
) : Iterable<Hjelpemiddel> by hjelpemidler {
131+
/**
132+
* Sett av alle [ArtikkelBase.hmsArtNr] fra alle hjelpemidler og tilbehør.
133+
*/
134+
val hmsArtNrs: Set<String>
135+
@JsonIgnore
136+
get() {
137+
val destination = hjelpemidler.flatMapTo(sortedSetOf()) {
138+
it.tilbehør.mapTo(sortedSetOf(it.hmsArtNr), Tilbehør::hmsArtNr)
139+
}
140+
tilbehør.mapTo(destination, Tilbehør::hmsArtNr)
141+
return destination
142+
}
143+
}
131144

132145
interface ArtikkelBase {
133146
val hmsArtNr: String

0 commit comments

Comments
 (0)