Skip to content

Commit

Permalink
F - Oppdatering av vaskFnr i Foedselnummer
Browse files Browse the repository at this point in the history
Co-authored-by: Mariam Pervez <[email protected]>
  • Loading branch information
dskarpas and MariamPervez committed Nov 20, 2023
1 parent 2089c91 commit ba78314
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ class KafkaStoppingErrorHandler : CommonContainerStoppingErrorHandler() {

fun textListingOf(records: List<ConsumerRecord<*, *>>) =
records.joinToString(separator = "\n") {
"-" .repeat(20) + "\n" + vask11sifre(it.toString())
"-" .repeat(20) + "\n" + vaskFnr(it.toString())
}

private fun vask11sifre(tekst: String) = tekst.replace(Regex("""\b\d{11}\b"""), "***")
private fun vaskFnr(tekst: String) = tekst.replace(Regex("""\b\d{11}\b"""), "***")
}
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,6 @@ class Fodselsnummer private constructor(@JsonValue val value: String) {
throw IllegalStateException("Ugyldig individnummer: $individnummer")
}



companion object {
@JvmStatic
@JsonCreator
Expand All @@ -132,11 +130,9 @@ class Fodselsnummer private constructor(@JsonValue val value: String) {
}
}

fun vask11sifre(nummer: String?): String {
return if(nummer.isNullOrBlank() || nummer.length != 11) ""
else {
nummer.replace(Regex("""\b\d{11}\b"""), "***")
}
fun vaskFnr(nummer: String?): String? {
return if(nummer.isNullOrBlank()) null
else nummer.replace(Regex("""\b\d{11}\b"""), "***")
}

fun fraMedValidation(fnr: String?): Fodselsnummer? {
Expand Down

0 comments on commit ba78314

Please sign in to comment.