From 59d8744c8448223e2ecea958bbe045f198766549 Mon Sep 17 00:00:00 2001
From: Paul-Christian Volkmer
Date: Sat, 17 Feb 2024 14:58:24 +0100
Subject: refactor: move mtb file controller into package input
---
.../etl/processor/input/MtbFileRestController.kt | 61 ++++++++++++++++++++++
.../etl/processor/web/MtbFileRestController.kt | 61 ----------------------
2 files changed, 61 insertions(+), 61 deletions(-)
create mode 100644 src/main/kotlin/dev/dnpm/etl/processor/input/MtbFileRestController.kt
delete mode 100644 src/main/kotlin/dev/dnpm/etl/processor/web/MtbFileRestController.kt
(limited to 'src/main')
diff --git a/src/main/kotlin/dev/dnpm/etl/processor/input/MtbFileRestController.kt b/src/main/kotlin/dev/dnpm/etl/processor/input/MtbFileRestController.kt
new file mode 100644
index 0000000..8259288
--- /dev/null
+++ b/src/main/kotlin/dev/dnpm/etl/processor/input/MtbFileRestController.kt
@@ -0,0 +1,61 @@
+/*
+ * This file is part of ETL-Processor
+ *
+ * Copyright (c) 2024 Comprehensive Cancer Center Mainfranken, Datenintegrationszentrum Philipps-Universität Marburg and Contributors
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+package dev.dnpm.etl.processor.input
+
+import de.ukw.ccc.bwhc.dto.Consent
+import de.ukw.ccc.bwhc.dto.MtbFile
+import dev.dnpm.etl.processor.services.RequestProcessor
+import org.slf4j.LoggerFactory
+import org.springframework.http.ResponseEntity
+import org.springframework.web.bind.annotation.*
+
+@RestController
+@RequestMapping(path = ["mtbfile"])
+class MtbFileRestController(
+ private val requestProcessor: RequestProcessor,
+) {
+
+ private val logger = LoggerFactory.getLogger(MtbFileRestController::class.java)
+
+ @GetMapping
+ fun info(): ResponseEntity {
+ return ResponseEntity.ok("Test")
+ }
+
+ @PostMapping
+ fun mtbFile(@RequestBody mtbFile: MtbFile): ResponseEntity {
+ if (mtbFile.consent.status == Consent.Status.ACTIVE) {
+ logger.debug("Accepted MTB File for processing")
+ requestProcessor.processMtbFile(mtbFile)
+ } else {
+ logger.debug("Accepted MTB File and process deletion")
+ requestProcessor.processDeletion(mtbFile.patient.id)
+ }
+ return ResponseEntity.accepted().build()
+ }
+
+ @DeleteMapping(path = ["{patientId}"])
+ fun deleteData(@PathVariable patientId: String): ResponseEntity {
+ logger.debug("Accepted patient ID to process deletion")
+ requestProcessor.processDeletion(patientId)
+ return ResponseEntity.accepted().build()
+ }
+
+}
\ No newline at end of file
diff --git a/src/main/kotlin/dev/dnpm/etl/processor/web/MtbFileRestController.kt b/src/main/kotlin/dev/dnpm/etl/processor/web/MtbFileRestController.kt
deleted file mode 100644
index d417a1f..0000000
--- a/src/main/kotlin/dev/dnpm/etl/processor/web/MtbFileRestController.kt
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * This file is part of ETL-Processor
- *
- * Copyright (c) 2023 Comprehensive Cancer Center Mainfranken, Datenintegrationszentrum Philipps-Universität Marburg and Contributors
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published
- * by the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see .
- */
-
-package dev.dnpm.etl.processor.web
-
-import de.ukw.ccc.bwhc.dto.Consent
-import de.ukw.ccc.bwhc.dto.MtbFile
-import dev.dnpm.etl.processor.services.RequestProcessor
-import org.slf4j.LoggerFactory
-import org.springframework.http.ResponseEntity
-import org.springframework.web.bind.annotation.*
-
-@RestController
-@RequestMapping(path = ["mtbfile"])
-class MtbFileRestController(
- private val requestProcessor: RequestProcessor,
-) {
-
- private val logger = LoggerFactory.getLogger(MtbFileRestController::class.java)
-
- @GetMapping
- fun info(): ResponseEntity {
- return ResponseEntity.ok("Test")
- }
-
- @PostMapping
- fun mtbFile(@RequestBody mtbFile: MtbFile): ResponseEntity {
- if (mtbFile.consent.status == Consent.Status.ACTIVE) {
- logger.debug("Accepted MTB File for processing")
- requestProcessor.processMtbFile(mtbFile)
- } else {
- logger.debug("Accepted MTB File and process deletion")
- requestProcessor.processDeletion(mtbFile.patient.id)
- }
- return ResponseEntity.accepted().build()
- }
-
- @DeleteMapping(path = ["{patientId}"])
- fun deleteData(@PathVariable patientId: String): ResponseEntity {
- logger.debug("Accepted patient ID to process deletion")
- requestProcessor.processDeletion(patientId)
- return ResponseEntity.accepted().build()
- }
-
-}
\ No newline at end of file
--
cgit v1.2.3