mirror of
https://github.com/pcvolkmer/etl-processor.git
synced 2025-04-19 17:26:51 +00:00
refactor: use UriComponentsBuilder to build URL to be used
This prevents problems using trailing slash in remote API URL.
This commit is contained in:
parent
775a7df1ce
commit
f347653be8
@ -23,19 +23,27 @@ import dev.dnpm.etl.processor.PatientPseudonym
|
|||||||
import dev.dnpm.etl.processor.config.RestTargetProperties
|
import dev.dnpm.etl.processor.config.RestTargetProperties
|
||||||
import org.springframework.retry.support.RetryTemplate
|
import org.springframework.retry.support.RetryTemplate
|
||||||
import org.springframework.web.client.RestTemplate
|
import org.springframework.web.client.RestTemplate
|
||||||
|
import org.springframework.web.util.UriComponentsBuilder
|
||||||
|
|
||||||
class RestBwhcMtbFileSender(
|
class RestBwhcMtbFileSender(
|
||||||
private val restTemplate: RestTemplate,
|
restTemplate: RestTemplate,
|
||||||
private val restTargetProperties: RestTargetProperties,
|
private val restTargetProperties: RestTargetProperties,
|
||||||
private val retryTemplate: RetryTemplate
|
retryTemplate: RetryTemplate
|
||||||
) : RestMtbFileSender(restTemplate, restTargetProperties, retryTemplate) {
|
) : RestMtbFileSender(restTemplate, restTargetProperties, retryTemplate) {
|
||||||
|
|
||||||
override fun sendUrl(): String {
|
override fun sendUrl(): String {
|
||||||
return "${restTargetProperties.uri}/MTBFile"
|
return UriComponentsBuilder
|
||||||
|
.fromUriString(restTargetProperties.uri.toString())
|
||||||
|
.pathSegment("MTBFile")
|
||||||
|
.toUriString()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun deleteUrl(patientId: PatientPseudonym): String {
|
override fun deleteUrl(patientId: PatientPseudonym): String {
|
||||||
return "${restTargetProperties.uri}/Patient/${patientId.value}"
|
return UriComponentsBuilder
|
||||||
|
.fromUriString(restTargetProperties.uri.toString())
|
||||||
|
.pathSegment("Patient")
|
||||||
|
.pathSegment(patientId.value)
|
||||||
|
.toUriString()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -23,19 +23,31 @@ import dev.dnpm.etl.processor.PatientPseudonym
|
|||||||
import dev.dnpm.etl.processor.config.RestTargetProperties
|
import dev.dnpm.etl.processor.config.RestTargetProperties
|
||||||
import org.springframework.retry.support.RetryTemplate
|
import org.springframework.retry.support.RetryTemplate
|
||||||
import org.springframework.web.client.RestTemplate
|
import org.springframework.web.client.RestTemplate
|
||||||
|
import org.springframework.web.util.UriComponentsBuilder
|
||||||
|
|
||||||
class RestDipMtbFileSender(
|
class RestDipMtbFileSender(
|
||||||
private val restTemplate: RestTemplate,
|
restTemplate: RestTemplate,
|
||||||
private val restTargetProperties: RestTargetProperties,
|
private val restTargetProperties: RestTargetProperties,
|
||||||
private val retryTemplate: RetryTemplate
|
retryTemplate: RetryTemplate
|
||||||
) : RestMtbFileSender(restTemplate, restTargetProperties, retryTemplate) {
|
) : RestMtbFileSender(restTemplate, restTargetProperties, retryTemplate) {
|
||||||
|
|
||||||
override fun sendUrl(): String {
|
override fun sendUrl(): String {
|
||||||
return "${restTargetProperties.uri}/patient-record"
|
return UriComponentsBuilder
|
||||||
|
.fromUriString(restTargetProperties.uri.toString())
|
||||||
|
.pathSegment("mtb")
|
||||||
|
.pathSegment("etl")
|
||||||
|
.pathSegment("patient-record")
|
||||||
|
.toUriString()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun deleteUrl(patientId: PatientPseudonym): String {
|
override fun deleteUrl(patientId: PatientPseudonym): String {
|
||||||
return "${restTargetProperties.uri}/patient/${patientId.value}"
|
return UriComponentsBuilder
|
||||||
|
.fromUriString(restTargetProperties.uri.toString())
|
||||||
|
.pathSegment("mtb")
|
||||||
|
.pathSegment("etl")
|
||||||
|
.pathSegment("patient")
|
||||||
|
.pathSegment(patientId.value)
|
||||||
|
.toUriString()
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user