Skip to content

Commit

Permalink
r - Sjekker om saksbehandler er null eller tom før vi kaller NavAnsatt
Browse files Browse the repository at this point in the history
  • Loading branch information
MariamPervez committed Dec 12, 2024
1 parent a223384 commit 0703819
Showing 1 changed file with 14 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,22 @@ class NavansattKlient(private val navansattRestTemplate: RestTemplate,
//@Cacheable("hentNavansatt")
fun hentAnsatt(saksbehandler: String): String? {
val path = "/navansatt/$saksbehandler"
try {
val json = navansattRestTemplate.exchange(
path,
HttpMethod.GET,
null,
String::class.java
).body.orEmpty()
return json
} catch (ex: Exception) {
logger.error("En feil oppstod under henting av saksbehandler fra navansatt ex: $ex")
if(!saksbehandler.isNullOrBlank()) {
logger.info("Henter saksbehandler fra navansatt: $saksbehandler")
try {
val json = navansattRestTemplate.exchange(
path,
HttpMethod.GET,
null,
String::class.java
).body.orEmpty()
return json
} catch (ex: Exception) {
logger.error("En feil oppstod under henting av saksbehandler fra navansatt ex: $ex")
}
}
return null
logger.info("Saksbehandler: $saksbehandler er tom ved kall til hent Navansatt")
}

//Pair(saksbehandlerIdent, enhetsId)
Expand Down

0 comments on commit 0703819

Please sign in to comment.