From 06b5381e885cf5cf4cb008e22e7cb2dff88f40b5 Mon Sep 17 00:00:00 2001 From: Paul-Christian Volkmer Date: Mon, 8 May 2023 11:56:35 +0200 Subject: [PATCH] =?UTF-8?q?Verschiebe=20Implementierungen=20f=C3=BCr=20The?= =?UTF-8?q?rapiepl=C3=A4ne=20in=20eigenes=20Paket?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DNPM/analyzer/TherapieplanAnalyzer.java | 2 +- .../java/DNPM/config/PluginConfiguration.java | 1 + .../DNPM/services/TherapieplanService.java | 33 ----------- .../services/TherapieplanServiceFactory.java | 31 ---------- .../DefaultTherapieplanService.java | 27 ++++++++- .../MultipleMtbTherapieplanService.java | 27 ++++++++- .../therapieplan/TherapieplanService.java | 57 +++++++++++++++++++ .../TherapieplanServiceFactory.java | 57 +++++++++++++++++++ .../analyzer/TherapieplanAnalyzerTest.java | 3 + .../DNPM/config/PluginConfigurationTest.java | 2 +- .../DefaultTherapieplanServiceTest.java | 29 +++++++++- .../TherapieplanServiceFactoryTest.java | 31 +++++++++- 12 files changed, 230 insertions(+), 70 deletions(-) delete mode 100644 src/main/java/DNPM/services/TherapieplanService.java delete mode 100644 src/main/java/DNPM/services/TherapieplanServiceFactory.java rename src/main/java/DNPM/services/{ => therapieplan}/DefaultTherapieplanService.java (84%) rename src/main/java/DNPM/services/{ => therapieplan}/MultipleMtbTherapieplanService.java (67%) create mode 100644 src/main/java/DNPM/services/therapieplan/TherapieplanService.java create mode 100644 src/main/java/DNPM/services/therapieplan/TherapieplanServiceFactory.java rename src/test/java/DNPM/services/{ => therapieplan}/DefaultTherapieplanServiceTest.java (78%) rename src/test/java/DNPM/services/{ => therapieplan}/TherapieplanServiceFactoryTest.java (50%) diff --git a/src/main/java/DNPM/analyzer/TherapieplanAnalyzer.java b/src/main/java/DNPM/analyzer/TherapieplanAnalyzer.java index 6ad18b0..3024125 100644 --- a/src/main/java/DNPM/analyzer/TherapieplanAnalyzer.java +++ b/src/main/java/DNPM/analyzer/TherapieplanAnalyzer.java @@ -4,7 +4,7 @@ import DNPM.security.DelegatingDataBasedPermissionEvaluator; import DNPM.security.PermissionType; import DNPM.services.Studie; import DNPM.services.StudienService; -import DNPM.services.TherapieplanServiceFactory; +import DNPM.services.therapieplan.TherapieplanServiceFactory; import DNPM.services.mtb.MtbService; import de.itc.onkostar.api.Disease; import de.itc.onkostar.api.Procedure; diff --git a/src/main/java/DNPM/config/PluginConfiguration.java b/src/main/java/DNPM/config/PluginConfiguration.java index 0042fe4..28abbda 100644 --- a/src/main/java/DNPM/config/PluginConfiguration.java +++ b/src/main/java/DNPM/config/PluginConfiguration.java @@ -7,6 +7,7 @@ import DNPM.services.mtb.DefaultMtbService; import DNPM.services.mtb.MtbService; import DNPM.services.systemtherapie.DefaultSystemtherapieService; import DNPM.services.systemtherapie.SystemtherapieService; +import DNPM.services.therapieplan.TherapieplanServiceFactory; import de.itc.onkostar.api.IOnkostarApi; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; diff --git a/src/main/java/DNPM/services/TherapieplanService.java b/src/main/java/DNPM/services/TherapieplanService.java deleted file mode 100644 index 7a725fc..0000000 --- a/src/main/java/DNPM/services/TherapieplanService.java +++ /dev/null @@ -1,33 +0,0 @@ -package DNPM.services; - -import de.itc.onkostar.api.Procedure; - -import java.util.List; - -public interface TherapieplanService { - - /** - * Verlinke MTB und Übernahme Datum aus Hauptformular in weiteren Bereichen - * "Humangenetische Beratung" und "Reevaluation" und Unterformularen, wenn erforderlich. - * - * @param procedure Die Prozedur mit Hauptformular - */ - void updateRequiredMtbEntries(Procedure procedure); - - /** - * Finde verlinkte MTBs in Hauptformular und Unterformularen - * - * @param procedure Die Prozedur mit Hauptformular - * @return Liste mit verlinkten MTBs - */ - List findReferencedMtbs(Procedure procedure); - - /** - * Finde verlinkte MTBs in Hauptformular und Unterformularen - * - * @param procedureId ID der Prozedur mit Hauptformular - * @return Liste mit verlinkten MTBs - */ - List findReferencedMtbs(int procedureId); - -} diff --git a/src/main/java/DNPM/services/TherapieplanServiceFactory.java b/src/main/java/DNPM/services/TherapieplanServiceFactory.java deleted file mode 100644 index 3e05fb4..0000000 --- a/src/main/java/DNPM/services/TherapieplanServiceFactory.java +++ /dev/null @@ -1,31 +0,0 @@ -package DNPM.services; - -import de.itc.onkostar.api.IOnkostarApi; - -public class TherapieplanServiceFactory { - - private final IOnkostarApi onkostarApi; - - private final SettingsService settingsService; - - private final FormService formService; - - public TherapieplanServiceFactory( - final IOnkostarApi onkostarApi, - final SettingsService settingsService, - final FormService formService - ) { - this.onkostarApi = onkostarApi; - this.settingsService = settingsService; - this.formService = formService; - } - - public TherapieplanService currentUsableInstance() { - if (settingsService.multipleMtbsInMtbEpisode()) { - return new MultipleMtbTherapieplanService(onkostarApi, formService); - } - - return new DefaultTherapieplanService(onkostarApi, formService); - } - -} diff --git a/src/main/java/DNPM/services/DefaultTherapieplanService.java b/src/main/java/DNPM/services/therapieplan/DefaultTherapieplanService.java similarity index 84% rename from src/main/java/DNPM/services/DefaultTherapieplanService.java rename to src/main/java/DNPM/services/therapieplan/DefaultTherapieplanService.java index eee2041..8fe3780 100644 --- a/src/main/java/DNPM/services/DefaultTherapieplanService.java +++ b/src/main/java/DNPM/services/therapieplan/DefaultTherapieplanService.java @@ -1,5 +1,30 @@ -package DNPM.services; +/* + * MIT License + * + * 2023 Comprehensive Cancer Center Mainfranken + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package DNPM.services.therapieplan; + +import DNPM.services.FormService; import de.itc.onkostar.api.IOnkostarApi; import de.itc.onkostar.api.Item; import de.itc.onkostar.api.Procedure; diff --git a/src/main/java/DNPM/services/MultipleMtbTherapieplanService.java b/src/main/java/DNPM/services/therapieplan/MultipleMtbTherapieplanService.java similarity index 67% rename from src/main/java/DNPM/services/MultipleMtbTherapieplanService.java rename to src/main/java/DNPM/services/therapieplan/MultipleMtbTherapieplanService.java index faded4b..11ce876 100644 --- a/src/main/java/DNPM/services/MultipleMtbTherapieplanService.java +++ b/src/main/java/DNPM/services/therapieplan/MultipleMtbTherapieplanService.java @@ -1,5 +1,30 @@ -package DNPM.services; +/* + * MIT License + * + * 2023 Comprehensive Cancer Center Mainfranken + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package DNPM.services.therapieplan; + +import DNPM.services.FormService; import de.itc.onkostar.api.IOnkostarApi; import de.itc.onkostar.api.Procedure; diff --git a/src/main/java/DNPM/services/therapieplan/TherapieplanService.java b/src/main/java/DNPM/services/therapieplan/TherapieplanService.java new file mode 100644 index 0000000..3699bb0 --- /dev/null +++ b/src/main/java/DNPM/services/therapieplan/TherapieplanService.java @@ -0,0 +1,57 @@ +/* + * MIT License + * + * 2023 Comprehensive Cancer Center Mainfranken + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package DNPM.services.therapieplan; + +import de.itc.onkostar.api.Procedure; + +import java.util.List; + +public interface TherapieplanService { + + /** + * Verlinke MTB und Übernahme Datum aus Hauptformular in weiteren Bereichen + * "Humangenetische Beratung" und "Reevaluation" und Unterformularen, wenn erforderlich. + * + * @param procedure Die Prozedur mit Hauptformular + */ + void updateRequiredMtbEntries(Procedure procedure); + + /** + * Finde verlinkte MTBs in Hauptformular und Unterformularen + * + * @param procedure Die Prozedur mit Hauptformular + * @return Liste mit verlinkten MTBs + */ + List findReferencedMtbs(Procedure procedure); + + /** + * Finde verlinkte MTBs in Hauptformular und Unterformularen + * + * @param procedureId ID der Prozedur mit Hauptformular + * @return Liste mit verlinkten MTBs + */ + List findReferencedMtbs(int procedureId); + +} diff --git a/src/main/java/DNPM/services/therapieplan/TherapieplanServiceFactory.java b/src/main/java/DNPM/services/therapieplan/TherapieplanServiceFactory.java new file mode 100644 index 0000000..041a3cc --- /dev/null +++ b/src/main/java/DNPM/services/therapieplan/TherapieplanServiceFactory.java @@ -0,0 +1,57 @@ +/* + * MIT License + * + * 2023 Comprehensive Cancer Center Mainfranken + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +package DNPM.services.therapieplan; + +import DNPM.services.FormService; +import DNPM.services.SettingsService; +import de.itc.onkostar.api.IOnkostarApi; + +public class TherapieplanServiceFactory { + + private final IOnkostarApi onkostarApi; + + private final SettingsService settingsService; + + private final FormService formService; + + public TherapieplanServiceFactory( + final IOnkostarApi onkostarApi, + final SettingsService settingsService, + final FormService formService + ) { + this.onkostarApi = onkostarApi; + this.settingsService = settingsService; + this.formService = formService; + } + + public TherapieplanService currentUsableInstance() { + if (settingsService.multipleMtbsInMtbEpisode()) { + return new MultipleMtbTherapieplanService(onkostarApi, formService); + } + + return new DefaultTherapieplanService(onkostarApi, formService); + } + +} diff --git a/src/test/java/DNPM/analyzer/TherapieplanAnalyzerTest.java b/src/test/java/DNPM/analyzer/TherapieplanAnalyzerTest.java index c2c17f1..ffd886b 100644 --- a/src/test/java/DNPM/analyzer/TherapieplanAnalyzerTest.java +++ b/src/test/java/DNPM/analyzer/TherapieplanAnalyzerTest.java @@ -4,6 +4,9 @@ import DNPM.security.DelegatingDataBasedPermissionEvaluator; import DNPM.security.PermissionType; import DNPM.services.*; import DNPM.services.mtb.MtbService; +import DNPM.services.therapieplan.MultipleMtbTherapieplanService; +import DNPM.services.therapieplan.TherapieplanService; +import DNPM.services.therapieplan.TherapieplanServiceFactory; import de.itc.onkostar.api.IOnkostarApi; import de.itc.onkostar.api.Item; import de.itc.onkostar.api.Procedure; diff --git a/src/test/java/DNPM/config/PluginConfigurationTest.java b/src/test/java/DNPM/config/PluginConfigurationTest.java index 606817b..87a4e19 100644 --- a/src/test/java/DNPM/config/PluginConfigurationTest.java +++ b/src/test/java/DNPM/config/PluginConfigurationTest.java @@ -2,7 +2,7 @@ package DNPM.config; import DNPM.services.FormService; import DNPM.services.SettingsService; -import DNPM.services.TherapieplanServiceFactory; +import DNPM.services.therapieplan.TherapieplanServiceFactory; import DNPM.services.consent.ConsentManagerServiceFactory; import de.itc.onkostar.api.IOnkostarApi; import org.junit.jupiter.api.BeforeEach; diff --git a/src/test/java/DNPM/services/DefaultTherapieplanServiceTest.java b/src/test/java/DNPM/services/therapieplan/DefaultTherapieplanServiceTest.java similarity index 78% rename from src/test/java/DNPM/services/DefaultTherapieplanServiceTest.java rename to src/test/java/DNPM/services/therapieplan/DefaultTherapieplanServiceTest.java index 0e9369f..527e428 100644 --- a/src/test/java/DNPM/services/DefaultTherapieplanServiceTest.java +++ b/src/test/java/DNPM/services/therapieplan/DefaultTherapieplanServiceTest.java @@ -1,5 +1,32 @@ -package DNPM.services; +/* + * MIT License + * + * 2023 Comprehensive Cancer Center Mainfranken + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package DNPM.services.therapieplan; + +import DNPM.services.FormService; +import DNPM.services.therapieplan.DefaultTherapieplanService; +import DNPM.services.therapieplan.TherapieplanService; import de.itc.onkostar.api.IOnkostarApi; import de.itc.onkostar.api.Item; import de.itc.onkostar.api.Procedure; diff --git a/src/test/java/DNPM/services/TherapieplanServiceFactoryTest.java b/src/test/java/DNPM/services/therapieplan/TherapieplanServiceFactoryTest.java similarity index 50% rename from src/test/java/DNPM/services/TherapieplanServiceFactoryTest.java rename to src/test/java/DNPM/services/therapieplan/TherapieplanServiceFactoryTest.java index 9ba543f..746d711 100644 --- a/src/test/java/DNPM/services/TherapieplanServiceFactoryTest.java +++ b/src/test/java/DNPM/services/therapieplan/TherapieplanServiceFactoryTest.java @@ -1,5 +1,34 @@ -package DNPM.services; +/* + * MIT License + * + * 2023 Comprehensive Cancer Center Mainfranken + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ +package DNPM.services.therapieplan; + +import DNPM.services.FormService; +import DNPM.services.SettingsService; +import DNPM.services.therapieplan.DefaultTherapieplanService; +import DNPM.services.therapieplan.MultipleMtbTherapieplanService; +import DNPM.services.therapieplan.TherapieplanServiceFactory; import de.itc.onkostar.api.IOnkostarApi; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test;