diff options
| author | Paul-Christian Volkmer | 2023-08-02 16:10:18 +0200 |
|---|---|---|
| committer | Paul-Christian Volkmer | 2023-08-02 16:10:18 +0200 |
| commit | 35cb258b13543b37ce061f78eef4427e542ca72a (patch) | |
| tree | 7d55a83341f237d4595c4e9e3d3179a946c992ad /src/main/kotlin/dev/dnpm | |
| parent | 51cf7a7917d7376d1e7c685b9c0e56d8929ad9e1 (diff) | |
Do not return specific status code based on remote status code
Diffstat (limited to 'src/main/kotlin/dev/dnpm')
| -rw-r--r-- | src/main/kotlin/dev/dnpm/etl/processor/services/RequestProcessor.kt | 17 | ||||
| -rw-r--r-- | src/main/kotlin/dev/dnpm/etl/processor/web/MtbFileController.kt | 21 |
2 files changed, 10 insertions, 28 deletions
diff --git a/src/main/kotlin/dev/dnpm/etl/processor/services/RequestProcessor.kt b/src/main/kotlin/dev/dnpm/etl/processor/services/RequestProcessor.kt index 8588ebe..7d110b1 100644 --- a/src/main/kotlin/dev/dnpm/etl/processor/services/RequestProcessor.kt +++ b/src/main/kotlin/dev/dnpm/etl/processor/services/RequestProcessor.kt @@ -42,7 +42,7 @@ class RequestProcessor( private val logger = LoggerFactory.getLogger(RequestProcessor::class.java) - fun processMtbFile(mtbFile: MtbFile): RequestStatus { + fun processMtbFile(mtbFile: MtbFile) { val pid = mtbFile.patient.id val pseudonymized = pseudonymizeService.pseudonymize(mtbFile) @@ -62,7 +62,7 @@ class RequestProcessor( ) ) statisticsUpdateProducer.emitNext("", Sinks.EmitFailureHandler.FAIL_FAST) - return RequestStatus.DUPLICATION + return } val request = MtbFileSender.MtbFileRequest(UUID.randomUUID().toString(), pseudonymized) @@ -115,11 +115,9 @@ class RequestProcessor( ) statisticsUpdateProducer.emitNext("", Sinks.EmitFailureHandler.FAIL_FAST) - - return requestStatus } - fun processDeletion(patientId: String): RequestStatus { + fun processDeletion(patientId: String) { val requestId = UUID.randomUUID().toString() try { @@ -178,10 +176,6 @@ class RequestProcessor( } ) ) - - statisticsUpdateProducer.emitNext("", Sinks.EmitFailureHandler.FAIL_FAST) - - return overallRequestStatus } catch (e: Exception) { requestRepository.save( Request( @@ -194,11 +188,8 @@ class RequestProcessor( report = Report("Fehler bei der Pseudonymisierung") ) ) - - statisticsUpdateProducer.emitNext("", Sinks.EmitFailureHandler.FAIL_FAST) - - return RequestStatus.ERROR } + statisticsUpdateProducer.emitNext("", Sinks.EmitFailureHandler.FAIL_FAST) } private fun fingerprint(mtbFile: MtbFile): String { diff --git a/src/main/kotlin/dev/dnpm/etl/processor/web/MtbFileController.kt b/src/main/kotlin/dev/dnpm/etl/processor/web/MtbFileController.kt index a2cc953..cf0e693 100644 --- a/src/main/kotlin/dev/dnpm/etl/processor/web/MtbFileController.kt +++ b/src/main/kotlin/dev/dnpm/etl/processor/web/MtbFileController.kt @@ -20,7 +20,6 @@ package dev.dnpm.etl.processor.web import de.ukw.ccc.bwhc.dto.MtbFile -import dev.dnpm.etl.processor.monitoring.RequestStatus import dev.dnpm.etl.processor.services.RequestProcessor import org.slf4j.LoggerFactory import org.springframework.http.ResponseEntity @@ -35,24 +34,16 @@ class MtbFileController( @PostMapping(path = ["/mtbfile"]) fun mtbFile(@RequestBody mtbFile: MtbFile): ResponseEntity<Void> { - val requestStatus = requestProcessor.processMtbFile(mtbFile) - - return if (requestStatus == RequestStatus.ERROR) { - ResponseEntity.unprocessableEntity().build() - } else { - ResponseEntity.noContent().build() - } + logger.debug("Accepted MTB File for processing") + requestProcessor.processMtbFile(mtbFile) + return ResponseEntity.accepted().build() } @DeleteMapping(path = ["/mtbfile/{patientId}"]) fun deleteData(@PathVariable patientId: String): ResponseEntity<Void> { - val requestStatus = requestProcessor.processDeletion(patientId) - - return if (requestStatus == RequestStatus.ERROR) { - ResponseEntity.unprocessableEntity().build() - } else { - ResponseEntity.noContent().build() - } + logger.debug("Accepted patient ID to process deletion") + requestProcessor.processDeletion(patientId) + return ResponseEntity.accepted().build() } }
\ No newline at end of file |
