Commit ab4c1c3 1 parent d3347bf commit ab4c1c3 Copy full SHA for ab4c1c3
File tree 3 files changed +16
-1
lines changed
kotlin/uk/gov/justice/digital/hmpps/hmppsintegrationapi
3 files changed +16
-1
lines changed Original file line number Diff line number Diff line change 1
1
package uk.gov.justice.digital.hmpps.hmppsintegrationapi.gateways
2
2
3
+ import org.slf4j.LoggerFactory
3
4
import org.springframework.beans.factory.annotation.Autowired
4
5
import org.springframework.beans.factory.annotation.Value
5
6
import org.springframework.http.HttpMethod
@@ -18,6 +19,8 @@ class PrisonerOffenderSearchGateway(
18
19
) {
19
20
private val webClient = WebClientWrapper (baseUrl)
20
21
22
+ private val log: org.slf4j.Logger = LoggerFactory .getLogger(this ::class .java)
23
+
21
24
@Autowired
22
25
lateinit var hmppsAuthGateway: HmppsAuthGateway
23
26
@@ -56,6 +59,7 @@ class PrisonerOffenderSearchGateway(
56
59
}
57
60
58
61
fun getPrisonOffender (nomsNumber : String ): Response <POSPrisoner ?> {
62
+ log.info(" looking up the person via prison search $nomsNumber " )
59
63
val result =
60
64
webClient.request<POSPrisoner >(
61
65
HttpMethod .GET ,
@@ -66,10 +70,12 @@ class PrisonerOffenderSearchGateway(
66
70
67
71
return when (result) {
68
72
is WebClientWrapperResponse .Success -> {
73
+ log.info(" found a match via prison search $nomsNumber " )
69
74
Response (data = result.data)
70
75
}
71
76
72
77
is WebClientWrapperResponse .Error -> {
78
+ log.error(" An error occurred getting person from prion search: ${result.errors} " )
73
79
Response (
74
80
data = null ,
75
81
errors = result.errors,
Original file line number Diff line number Diff line change 1
1
package uk.gov.justice.digital.hmpps.hmppsintegrationapi.services
2
2
3
+ import org.slf4j.LoggerFactory
3
4
import org.springframework.beans.factory.annotation.Autowired
4
5
import org.springframework.stereotype.Service
5
6
import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.HmppsId
@@ -10,14 +11,17 @@ import uk.gov.justice.digital.hmpps.hmppsintegrationapi.models.hmpps.Response
10
11
class GetHmppsIdService (
11
12
@Autowired val getPersonService : GetPersonService ,
12
13
) {
14
+ private val log: org.slf4j.Logger = LoggerFactory .getLogger(this ::class .java)
15
+
13
16
fun execute (hmppsId : String ): Response <HmppsId ?> {
14
17
val personResponse = getPersonService.execute(hmppsId.uppercase())
15
18
16
19
var hmppsIdToReturn =
17
20
personResponse.data?.hmppsId
18
-
21
+ log.info( " hmppsId from probation: $hmppsIdToReturn " )
19
22
if (hmppsIdToReturn == null ) {
20
23
hmppsIdToReturn = getPersonService.getPersonFromNomis(hmppsId.uppercase()).data?.prisonerNumber
24
+ log.info(" hmppsId from prison: $hmppsIdToReturn " )
21
25
}
22
26
23
27
return Response (
Original file line number Diff line number Diff line change @@ -114,3 +114,8 @@ authorisation:
114
114
- " /v1/persons/.*/plp/inductionScheduleUpdated"
115
115
- " /v1/hmpps/id/by-nomis-number/[^/]*$"
116
116
- " /v1/hmpps/id/nomis-number/by-hmpps-id/[^/]*$"
117
+
118
+ logging :
119
+ level :
120
+ root : INFO
121
+ uk.gov.justice.digital.hmpps.hmppsintegrationapi : DEBUG
You can’t perform that action at this time.
0 commit comments