From 9ac31db1a7c2ceef5ee119afe4db8101447bd9d8 Mon Sep 17 00:00:00 2001 From: "jannik.lange" Date: Wed, 11 Sep 2024 12:15:04 +0200 Subject: [PATCH 01/25] changed decision tree - removed escalationIndex #42 --- .../branches/WorkConflictBranch.java | 28 ------------------- 1 file changed, 28 deletions(-) diff --git a/src/main/java/de/muenchen/kobit/backend/decisiontree/branches/WorkConflictBranch.java b/src/main/java/de/muenchen/kobit/backend/decisiontree/branches/WorkConflictBranch.java index 6469f53..a73292d 100644 --- a/src/main/java/de/muenchen/kobit/backend/decisiontree/branches/WorkConflictBranch.java +++ b/src/main/java/de/muenchen/kobit/backend/decisiontree/branches/WorkConflictBranch.java @@ -85,31 +85,6 @@ public class WorkConflictBranch { Competence.STRESS_MEDIUM.toCompetenceView(), Competence.STRESS_HIGH.toCompetenceView())); - private final DecisionPoint n9 = - new DecisionPoint( - Competence.STRESS_HIGH, - escalationIndex, - List.of( - Competence.ESCALATION_LOW.toCompetenceView(), - Competence.ESCALATION_MEDIUM.toCompetenceView(), - Competence.ESCALATION_HIGH.toCompetenceView())); - private final DecisionPoint n10 = - new DecisionPoint( - Competence.STRESS_MEDIUM, - escalationIndex, - List.of( - Competence.ESCALATION_LOW.toCompetenceView(), - Competence.ESCALATION_MEDIUM.toCompetenceView(), - Competence.ESCALATION_HIGH.toCompetenceView())); - private final DecisionPoint n11 = - new DecisionPoint( - Competence.STRESS_LOW, - escalationIndex, - List.of( - Competence.ESCALATION_LOW.toCompetenceView(), - Competence.ESCALATION_MEDIUM.toCompetenceView(), - Competence.ESCALATION_HIGH.toCompetenceView())); - private final HashMap branchMap = new HashMap<>(); public WorkConflictBranch() { @@ -121,9 +96,6 @@ public WorkConflictBranch() { branchMap.put(n6.getCompetence(), n6); branchMap.put(n7.getCompetence(), n7); branchMap.put(n8.getCompetence(), n8); - branchMap.put(n9.getCompetence(), n9); - branchMap.put(n10.getCompetence(), n10); - branchMap.put(n11.getCompetence(), n11); } public DecisionPoint getNextNode(Competence competence) { From bdcf060ab36d92d6fc3f699697e7aa89095db598 Mon Sep 17 00:00:00 2001 From: "jannik.lange" Date: Wed, 11 Sep 2024 12:15:45 +0200 Subject: [PATCH 02/25] changed decision tree - added fk and changed description #42 --- .../decisiontree/branches/DiscriminationBranch.java | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/muenchen/kobit/backend/decisiontree/branches/DiscriminationBranch.java b/src/main/java/de/muenchen/kobit/backend/decisiontree/branches/DiscriminationBranch.java index e8ff931..71c0503 100644 --- a/src/main/java/de/muenchen/kobit/backend/decisiontree/branches/DiscriminationBranch.java +++ b/src/main/java/de/muenchen/kobit/backend/decisiontree/branches/DiscriminationBranch.java @@ -11,7 +11,7 @@ public class DiscriminationBranch { private final String roleQuestion = "Welche Rolle haben Sie?"; private final String kindOfDiscrimination = - "Aus welchem Grund werden Sie/fühlen Sie sich diskriminiert?"; + "Aus welchem Grund fühlen Sie sich diskriminiert?"; private final String kindOfSexualDiscrimination = "Mann-Frau Diskriminierung oder LGBTIQ* Diskriminierung?"; @@ -21,6 +21,7 @@ public class DiscriminationBranch { roleQuestion, List.of( Competence.EMPLOYEE.toCompetenceView(), + Competence.EXECUTIVE.toCompetenceView(), Competence.JUNIOR.toCompetenceView())); private final DecisionPoint n2 = @@ -41,6 +42,15 @@ public class DiscriminationBranch { Competence.SEXUAL_IDENTITY.toCompetenceView())); private final DecisionPoint n4 = + new DecisionPoint( + Competence.EXECUTIVE, + kindOfDiscrimination, + List.of( + Competence.ETHNIC_RACIAL.toCompetenceView(), + Competence.DISABLED.toCompetenceView(), + Competence.SEXUAL_IDENTITY.toCompetenceView())); + + private final DecisionPoint n5 = new DecisionPoint( Competence.SEXUAL_IDENTITY, kindOfSexualDiscrimination, From 8843412398fe8ddf7116af41f27d81b3b9090492 Mon Sep 17 00:00:00 2001 From: "jannik.lange" Date: Wed, 11 Sep 2024 15:25:16 +0200 Subject: [PATCH 03/25] changed decision tree - added decision-points #42 --- .../kobit/backend/competence/Competence.java | 9 +++++---- .../branches/DiscriminationBranch.java | 16 +++++++++++++++- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/main/java/de/muenchen/kobit/backend/competence/Competence.java b/src/main/java/de/muenchen/kobit/backend/competence/Competence.java index 540d995..47aac36 100644 --- a/src/main/java/de/muenchen/kobit/backend/competence/Competence.java +++ b/src/main/java/de/muenchen/kobit/backend/competence/Competence.java @@ -67,11 +67,12 @@ public enum Competence { // reasons of discrimination ETHNIC_RACIAL( - "Diskriminierung aufgrund ethnischer oder rassistischer Motive, Religion oder" - + " Weltanschauung, Alter", + "wegen rassistischer Motive, der ethnischen Herkunft, Religion, Weltanschauung", ""), - DISABLED("Diskriminierung aufgrund Behinderung", ""), - SEXUAL_IDENTITY("Diskriminierung aufgrund sexueller oder geschlechtlicher Identität", ""), + DISABLED("aufgrund Behinderung", ""), + SEXUAL_IDENTITY("wegen der sexuellen Identität", ""), + AGE("wegen Alter", ""), + SEXUALITY("wegen des Geschlechts", ""), // sexual discrimination EQUALITY("Gleichstellung Mann Frau", ""), diff --git a/src/main/java/de/muenchen/kobit/backend/decisiontree/branches/DiscriminationBranch.java b/src/main/java/de/muenchen/kobit/backend/decisiontree/branches/DiscriminationBranch.java index 71c0503..7ba15f9 100644 --- a/src/main/java/de/muenchen/kobit/backend/decisiontree/branches/DiscriminationBranch.java +++ b/src/main/java/de/muenchen/kobit/backend/decisiontree/branches/DiscriminationBranch.java @@ -4,6 +4,8 @@ import de.muenchen.kobit.backend.decisiontree.view.DecisionPoint; import java.util.HashMap; import java.util.List; + +import org.checkerframework.checker.units.qual.C; import org.springframework.stereotype.Component; @Component @@ -15,6 +17,7 @@ public class DiscriminationBranch { private final String kindOfSexualDiscrimination = "Mann-Frau Diskriminierung oder LGBTIQ* Diskriminierung?"; + // Welche Rolle haben Sie? private final DecisionPoint n1 = new DecisionPoint( Competence.DISCRIMINATION, @@ -24,21 +27,28 @@ public class DiscriminationBranch { Competence.EXECUTIVE.toCompetenceView(), Competence.JUNIOR.toCompetenceView())); + + // Aus welchem grund fühlen Sie sich diskrimiert? private final DecisionPoint n2 = new DecisionPoint( Competence.EMPLOYEE, kindOfDiscrimination, List.of( Competence.ETHNIC_RACIAL.toCompetenceView(), + Competence.AGE.toCompetenceView(), Competence.DISABLED.toCompetenceView(), - Competence.SEXUAL_IDENTITY.toCompetenceView())); + Competence.SEXUALITY.toCompetenceView(), + Competence.SEXUAL_IDENTITY.toCompetenceView() + )); private final DecisionPoint n3 = new DecisionPoint( Competence.JUNIOR, kindOfDiscrimination, List.of( Competence.ETHNIC_RACIAL.toCompetenceView(), + Competence.AGE.toCompetenceView(), Competence.DISABLED.toCompetenceView(), + Competence.SEXUALITY.toCompetenceView(), Competence.SEXUAL_IDENTITY.toCompetenceView())); private final DecisionPoint n4 = @@ -47,9 +57,13 @@ public class DiscriminationBranch { kindOfDiscrimination, List.of( Competence.ETHNIC_RACIAL.toCompetenceView(), + Competence.AGE.toCompetenceView(), Competence.DISABLED.toCompetenceView(), + Competence.SEXUALITY.toCompetenceView(), Competence.SEXUAL_IDENTITY.toCompetenceView())); + + // other private final DecisionPoint n5 = new DecisionPoint( Competence.SEXUAL_IDENTITY, From 0646311e8790437015e4eaf7994c8bf71e427ded Mon Sep 17 00:00:00 2001 From: "jannik.lange" Date: Thu, 12 Sep 2024 16:21:23 +0200 Subject: [PATCH 04/25] corrected tests #42 --- .../branches/DiscriminationBranchTest.java | 21 +++---------------- 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/src/test/java/de/muenchen/kobit/backend/decisiontree/branches/DiscriminationBranchTest.java b/src/test/java/de/muenchen/kobit/backend/decisiontree/branches/DiscriminationBranchTest.java index b89197d..9a12794 100644 --- a/src/test/java/de/muenchen/kobit/backend/decisiontree/branches/DiscriminationBranchTest.java +++ b/src/test/java/de/muenchen/kobit/backend/decisiontree/branches/DiscriminationBranchTest.java @@ -23,7 +23,7 @@ void getNextNodeTest_start() { var competence = Competence.DISCRIMINATION; var result = discriminationBranch.getNextNode(competence); assertThat(result.getQuestion()).isEqualTo("Welche Rolle haben Sie?"); - assertThat(result.getAnswerOptions().size()).isEqualTo(2); + assertThat(result.getAnswerOptions().size()).isEqualTo(3); assertThat( result.getAnswerOptions().stream() .map(CompetenceView::getCompetence) @@ -37,8 +37,8 @@ void getNextNodeTest_junior() { var competence = Competence.JUNIOR; var result = discriminationBranch.getNextNode(competence); assertThat(result.getQuestion()) - .isEqualTo("Aus welchem Grund werden Sie/fühlen Sie sich diskriminiert?"); - assertThat(result.getAnswerOptions().size()).isEqualTo(3); + .isEqualTo("Aus welchem Grund fühlen Sie sich diskriminiert?"); + assertThat(result.getAnswerOptions().size()).isEqualTo(5); assertThat( result.getAnswerOptions().stream() .map(CompetenceView::getCompetence) @@ -51,21 +51,6 @@ void getNextNodeTest_junior() { .isTrue(); } - @Test - void getNextNodeTest_sexual() { - var competence = Competence.SEXUAL_IDENTITY; - var result = discriminationBranch.getNextNode(competence); - assertThat(result.getQuestion()) - .isEqualTo("Mann-Frau Diskriminierung oder LGBTIQ* Diskriminierung?"); - assertThat(result.getAnswerOptions().size()).isEqualTo(2); - assertThat( - result.getAnswerOptions().stream() - .map(CompetenceView::getCompetence) - .collect(Collectors.toList()) - .containsAll(List.of(Competence.EQUALITY, Competence.LGBTIQ))) - .isTrue(); - } - @Test void getNextNodeTest_end() { var competence = Competence.DISABLED; From 5688ebdec1d66fa76f8cb37a0e08bda4788010a9 Mon Sep 17 00:00:00 2001 From: "jannik.lange" Date: Thu, 12 Sep 2024 16:21:23 +0200 Subject: [PATCH 05/25] corrected tests #42 --- .../kobit/backend/competence/Competence.java | 3 +-- .../branches/DiscriminationBranch.java | 10 ++------- .../branches/DiscriminationBranchTest.java | 21 +++---------------- 3 files changed, 6 insertions(+), 28 deletions(-) diff --git a/src/main/java/de/muenchen/kobit/backend/competence/Competence.java b/src/main/java/de/muenchen/kobit/backend/competence/Competence.java index 47aac36..9528a4d 100644 --- a/src/main/java/de/muenchen/kobit/backend/competence/Competence.java +++ b/src/main/java/de/muenchen/kobit/backend/competence/Competence.java @@ -67,8 +67,7 @@ public enum Competence { // reasons of discrimination ETHNIC_RACIAL( - "wegen rassistischer Motive, der ethnischen Herkunft, Religion, Weltanschauung", - ""), + "wegen rassistischer Motive, der ethnischen Herkunft, Religion, Weltanschauung", ""), DISABLED("aufgrund Behinderung", ""), SEXUAL_IDENTITY("wegen der sexuellen Identität", ""), AGE("wegen Alter", ""), diff --git a/src/main/java/de/muenchen/kobit/backend/decisiontree/branches/DiscriminationBranch.java b/src/main/java/de/muenchen/kobit/backend/decisiontree/branches/DiscriminationBranch.java index 7ba15f9..ec26179 100644 --- a/src/main/java/de/muenchen/kobit/backend/decisiontree/branches/DiscriminationBranch.java +++ b/src/main/java/de/muenchen/kobit/backend/decisiontree/branches/DiscriminationBranch.java @@ -4,16 +4,13 @@ import de.muenchen.kobit.backend.decisiontree.view.DecisionPoint; import java.util.HashMap; import java.util.List; - -import org.checkerframework.checker.units.qual.C; import org.springframework.stereotype.Component; @Component public class DiscriminationBranch { private final String roleQuestion = "Welche Rolle haben Sie?"; - private final String kindOfDiscrimination = - "Aus welchem Grund fühlen Sie sich diskriminiert?"; + private final String kindOfDiscrimination = "Aus welchem Grund fühlen Sie sich diskriminiert?"; private final String kindOfSexualDiscrimination = "Mann-Frau Diskriminierung oder LGBTIQ* Diskriminierung?"; @@ -27,7 +24,6 @@ public class DiscriminationBranch { Competence.EXECUTIVE.toCompetenceView(), Competence.JUNIOR.toCompetenceView())); - // Aus welchem grund fühlen Sie sich diskrimiert? private final DecisionPoint n2 = new DecisionPoint( @@ -38,8 +34,7 @@ public class DiscriminationBranch { Competence.AGE.toCompetenceView(), Competence.DISABLED.toCompetenceView(), Competence.SEXUALITY.toCompetenceView(), - Competence.SEXUAL_IDENTITY.toCompetenceView() - )); + Competence.SEXUAL_IDENTITY.toCompetenceView())); private final DecisionPoint n3 = new DecisionPoint( Competence.JUNIOR, @@ -62,7 +57,6 @@ public class DiscriminationBranch { Competence.SEXUALITY.toCompetenceView(), Competence.SEXUAL_IDENTITY.toCompetenceView())); - // other private final DecisionPoint n5 = new DecisionPoint( diff --git a/src/test/java/de/muenchen/kobit/backend/decisiontree/branches/DiscriminationBranchTest.java b/src/test/java/de/muenchen/kobit/backend/decisiontree/branches/DiscriminationBranchTest.java index b89197d..9a12794 100644 --- a/src/test/java/de/muenchen/kobit/backend/decisiontree/branches/DiscriminationBranchTest.java +++ b/src/test/java/de/muenchen/kobit/backend/decisiontree/branches/DiscriminationBranchTest.java @@ -23,7 +23,7 @@ void getNextNodeTest_start() { var competence = Competence.DISCRIMINATION; var result = discriminationBranch.getNextNode(competence); assertThat(result.getQuestion()).isEqualTo("Welche Rolle haben Sie?"); - assertThat(result.getAnswerOptions().size()).isEqualTo(2); + assertThat(result.getAnswerOptions().size()).isEqualTo(3); assertThat( result.getAnswerOptions().stream() .map(CompetenceView::getCompetence) @@ -37,8 +37,8 @@ void getNextNodeTest_junior() { var competence = Competence.JUNIOR; var result = discriminationBranch.getNextNode(competence); assertThat(result.getQuestion()) - .isEqualTo("Aus welchem Grund werden Sie/fühlen Sie sich diskriminiert?"); - assertThat(result.getAnswerOptions().size()).isEqualTo(3); + .isEqualTo("Aus welchem Grund fühlen Sie sich diskriminiert?"); + assertThat(result.getAnswerOptions().size()).isEqualTo(5); assertThat( result.getAnswerOptions().stream() .map(CompetenceView::getCompetence) @@ -51,21 +51,6 @@ void getNextNodeTest_junior() { .isTrue(); } - @Test - void getNextNodeTest_sexual() { - var competence = Competence.SEXUAL_IDENTITY; - var result = discriminationBranch.getNextNode(competence); - assertThat(result.getQuestion()) - .isEqualTo("Mann-Frau Diskriminierung oder LGBTIQ* Diskriminierung?"); - assertThat(result.getAnswerOptions().size()).isEqualTo(2); - assertThat( - result.getAnswerOptions().stream() - .map(CompetenceView::getCompetence) - .collect(Collectors.toList()) - .containsAll(List.of(Competence.EQUALITY, Competence.LGBTIQ))) - .isTrue(); - } - @Test void getNextNodeTest_end() { var competence = Competence.DISABLED; From af7570c726e5e5993eae256cbe3bf31c675b1c6a Mon Sep 17 00:00:00 2001 From: "jannik.lange" Date: Tue, 17 Sep 2024 11:58:00 +0200 Subject: [PATCH 06/25] wrong spelling #42 --- .../java/de/muenchen/kobit/backend/competence/Competence.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/muenchen/kobit/backend/competence/Competence.java b/src/main/java/de/muenchen/kobit/backend/competence/Competence.java index 9528a4d..57c10f4 100644 --- a/src/main/java/de/muenchen/kobit/backend/competence/Competence.java +++ b/src/main/java/de/muenchen/kobit/backend/competence/Competence.java @@ -79,8 +79,8 @@ public enum Competence { // Health Issues ADDICTION("Suchtproblem", ""), - PHYSICAL("körperliches Problem", ""), - PSYCHOLOGICAL("psychisches Problem", ""); + PHYSICAL("Körperliche Probleme", ""), + PSYCHOLOGICAL("Psychische Probleme", ""); public final String germanDescription; public final String shortDescription; From 656806007ecbed705bf513603bd66343d419188a Mon Sep 17 00:00:00 2001 From: "jannik.lange" Date: Tue, 17 Sep 2024 11:58:00 +0200 Subject: [PATCH 07/25] wrong spelling #42 --- .../de/muenchen/kobit/backend/competence/Competence.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/muenchen/kobit/backend/competence/Competence.java b/src/main/java/de/muenchen/kobit/backend/competence/Competence.java index 9528a4d..78bcc54 100644 --- a/src/main/java/de/muenchen/kobit/backend/competence/Competence.java +++ b/src/main/java/de/muenchen/kobit/backend/competence/Competence.java @@ -78,9 +78,9 @@ public enum Competence { LGBTIQ("LGBTIQ*", ""), // Health Issues - ADDICTION("Suchtproblem", ""), - PHYSICAL("körperliches Problem", ""), - PSYCHOLOGICAL("psychisches Problem", ""); + ADDICTION("Sucht", ""), + PHYSICAL("Körperliche Probleme", ""), + PSYCHOLOGICAL("Psychische Probleme", ""); public final String germanDescription; public final String shortDescription; From 66515a314da63bea4a085aba883424e9e0376188 Mon Sep 17 00:00:00 2001 From: "jannik.lange" Date: Tue, 24 Sep 2024 14:01:35 +0200 Subject: [PATCH 08/25] spelling mistakes and wrong order #42 --- .../de/muenchen/kobit/backend/competence/Competence.java | 4 ++-- .../backend/decisiontree/branches/HealthIssuesBranch.java | 2 +- .../kobit/backend/decisiontree/branches/MobbingBranch.java | 6 +++--- .../backend/decisiontree/branches/MobbingBranchTest.java | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/main/java/de/muenchen/kobit/backend/competence/Competence.java b/src/main/java/de/muenchen/kobit/backend/competence/Competence.java index 78bcc54..37a6c11 100644 --- a/src/main/java/de/muenchen/kobit/backend/competence/Competence.java +++ b/src/main/java/de/muenchen/kobit/backend/competence/Competence.java @@ -68,9 +68,9 @@ public enum Competence { // reasons of discrimination ETHNIC_RACIAL( "wegen rassistischer Motive, der ethnischen Herkunft, Religion, Weltanschauung", ""), - DISABLED("aufgrund Behinderung", ""), + DISABLED("wegen Behinderung", ""), SEXUAL_IDENTITY("wegen der sexuellen Identität", ""), - AGE("wegen Alter", ""), + AGE("wegen des Alters", ""), SEXUALITY("wegen des Geschlechts", ""), // sexual discrimination diff --git a/src/main/java/de/muenchen/kobit/backend/decisiontree/branches/HealthIssuesBranch.java b/src/main/java/de/muenchen/kobit/backend/decisiontree/branches/HealthIssuesBranch.java index 95f599f..8fdfafb 100644 --- a/src/main/java/de/muenchen/kobit/backend/decisiontree/branches/HealthIssuesBranch.java +++ b/src/main/java/de/muenchen/kobit/backend/decisiontree/branches/HealthIssuesBranch.java @@ -9,7 +9,7 @@ @Component public class HealthIssuesBranch { - private static final String kindOfHealthIssues = "Welches gesundheitliches Problem haben Sie?"; + private static final String kindOfHealthIssues = "Welches gesundheitliche Problem haben Sie?"; private final DecisionPoint n1 = new DecisionPoint( diff --git a/src/main/java/de/muenchen/kobit/backend/decisiontree/branches/MobbingBranch.java b/src/main/java/de/muenchen/kobit/backend/decisiontree/branches/MobbingBranch.java index 1d370e1..0434485 100644 --- a/src/main/java/de/muenchen/kobit/backend/decisiontree/branches/MobbingBranch.java +++ b/src/main/java/de/muenchen/kobit/backend/decisiontree/branches/MobbingBranch.java @@ -13,7 +13,7 @@ public class MobbingBranch { private final String whoIsMobbing = "Durch wen werden Sie gemobbt/fühlen Sie sich gemobbt?"; - private final String stressQuestion = "Wie hoch ist ihre persönliche Belastung?"; + private final String stressQuestion = "Wie hoch ist Ihre persönliche Belastung?"; private final DecisionPoint n1 = new DecisionPoint( @@ -21,8 +21,8 @@ public class MobbingBranch { roleQuestion, List.of( Competence.EMPLOYEE.toCompetenceView(), - Competence.JUNIOR.toCompetenceView(), - Competence.EXECUTIVE.toCompetenceView())); + Competence.EXECUTIVE.toCompetenceView(), + Competence.JUNIOR.toCompetenceView())); private final DecisionPoint n2 = new DecisionPoint( diff --git a/src/test/java/de/muenchen/kobit/backend/decisiontree/branches/MobbingBranchTest.java b/src/test/java/de/muenchen/kobit/backend/decisiontree/branches/MobbingBranchTest.java index c3e94fd..78dcfb5 100644 --- a/src/test/java/de/muenchen/kobit/backend/decisiontree/branches/MobbingBranchTest.java +++ b/src/test/java/de/muenchen/kobit/backend/decisiontree/branches/MobbingBranchTest.java @@ -70,7 +70,7 @@ void getNextNodeTest_oppositeExecutive() { Competence.STRESS_MEDIUM, Competence.STRESS_HIGH))) .isTrue(); - assertThat(result.getQuestion()).isEqualTo("Wie hoch ist ihre persönliche Belastung?"); + assertThat(result.getQuestion()).isEqualTo("Wie hoch ist Ihre persönliche Belastung?"); } @Test From 1bb4a2cd8451fc45a1f86470fe1f42e7a3fb8116 Mon Sep 17 00:00:00 2001 From: "jannik.lange" Date: Tue, 24 Sep 2024 14:01:35 +0200 Subject: [PATCH 09/25] spelling mistakes and wrong order #42 --- .../de/muenchen/kobit/backend/competence/Competence.java | 4 ++-- .../backend/decisiontree/branches/HealthIssuesBranch.java | 2 +- .../kobit/backend/decisiontree/branches/MobbingBranch.java | 6 +++--- .../decisiontree/branches/HealthIssuesBranchTest.java | 2 +- .../backend/decisiontree/branches/MobbingBranchTest.java | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main/java/de/muenchen/kobit/backend/competence/Competence.java b/src/main/java/de/muenchen/kobit/backend/competence/Competence.java index 78bcc54..37a6c11 100644 --- a/src/main/java/de/muenchen/kobit/backend/competence/Competence.java +++ b/src/main/java/de/muenchen/kobit/backend/competence/Competence.java @@ -68,9 +68,9 @@ public enum Competence { // reasons of discrimination ETHNIC_RACIAL( "wegen rassistischer Motive, der ethnischen Herkunft, Religion, Weltanschauung", ""), - DISABLED("aufgrund Behinderung", ""), + DISABLED("wegen Behinderung", ""), SEXUAL_IDENTITY("wegen der sexuellen Identität", ""), - AGE("wegen Alter", ""), + AGE("wegen des Alters", ""), SEXUALITY("wegen des Geschlechts", ""), // sexual discrimination diff --git a/src/main/java/de/muenchen/kobit/backend/decisiontree/branches/HealthIssuesBranch.java b/src/main/java/de/muenchen/kobit/backend/decisiontree/branches/HealthIssuesBranch.java index 95f599f..8fdfafb 100644 --- a/src/main/java/de/muenchen/kobit/backend/decisiontree/branches/HealthIssuesBranch.java +++ b/src/main/java/de/muenchen/kobit/backend/decisiontree/branches/HealthIssuesBranch.java @@ -9,7 +9,7 @@ @Component public class HealthIssuesBranch { - private static final String kindOfHealthIssues = "Welches gesundheitliches Problem haben Sie?"; + private static final String kindOfHealthIssues = "Welches gesundheitliche Problem haben Sie?"; private final DecisionPoint n1 = new DecisionPoint( diff --git a/src/main/java/de/muenchen/kobit/backend/decisiontree/branches/MobbingBranch.java b/src/main/java/de/muenchen/kobit/backend/decisiontree/branches/MobbingBranch.java index 1d370e1..0434485 100644 --- a/src/main/java/de/muenchen/kobit/backend/decisiontree/branches/MobbingBranch.java +++ b/src/main/java/de/muenchen/kobit/backend/decisiontree/branches/MobbingBranch.java @@ -13,7 +13,7 @@ public class MobbingBranch { private final String whoIsMobbing = "Durch wen werden Sie gemobbt/fühlen Sie sich gemobbt?"; - private final String stressQuestion = "Wie hoch ist ihre persönliche Belastung?"; + private final String stressQuestion = "Wie hoch ist Ihre persönliche Belastung?"; private final DecisionPoint n1 = new DecisionPoint( @@ -21,8 +21,8 @@ public class MobbingBranch { roleQuestion, List.of( Competence.EMPLOYEE.toCompetenceView(), - Competence.JUNIOR.toCompetenceView(), - Competence.EXECUTIVE.toCompetenceView())); + Competence.EXECUTIVE.toCompetenceView(), + Competence.JUNIOR.toCompetenceView())); private final DecisionPoint n2 = new DecisionPoint( diff --git a/src/test/java/de/muenchen/kobit/backend/decisiontree/branches/HealthIssuesBranchTest.java b/src/test/java/de/muenchen/kobit/backend/decisiontree/branches/HealthIssuesBranchTest.java index 858f960..8e416cc 100644 --- a/src/test/java/de/muenchen/kobit/backend/decisiontree/branches/HealthIssuesBranchTest.java +++ b/src/test/java/de/muenchen/kobit/backend/decisiontree/branches/HealthIssuesBranchTest.java @@ -28,7 +28,7 @@ void getNextNodeTest() { var competence = Competence.HEALTH_PROBLEMS; var result = healthIssuesBranch.getNextNode(competence); - assertThat(result.getQuestion()).isEqualTo("Welches gesundheitliches Problem haben Sie?"); + assertThat(result.getQuestion()).isEqualTo("Welches gesundheitliche Problem haben Sie?"); assertThat(result.getAnswerOptions().size()).isEqualTo(3); } } diff --git a/src/test/java/de/muenchen/kobit/backend/decisiontree/branches/MobbingBranchTest.java b/src/test/java/de/muenchen/kobit/backend/decisiontree/branches/MobbingBranchTest.java index c3e94fd..78dcfb5 100644 --- a/src/test/java/de/muenchen/kobit/backend/decisiontree/branches/MobbingBranchTest.java +++ b/src/test/java/de/muenchen/kobit/backend/decisiontree/branches/MobbingBranchTest.java @@ -70,7 +70,7 @@ void getNextNodeTest_oppositeExecutive() { Competence.STRESS_MEDIUM, Competence.STRESS_HIGH))) .isTrue(); - assertThat(result.getQuestion()).isEqualTo("Wie hoch ist ihre persönliche Belastung?"); + assertThat(result.getQuestion()).isEqualTo("Wie hoch ist Ihre persönliche Belastung?"); } @Test From c9a02b6adb94cc84327a5e6fb6a3c4df70f0e656 Mon Sep 17 00:00:00 2001 From: "jannik.lange" Date: Thu, 31 Oct 2024 16:45:05 +0100 Subject: [PATCH 10/25] improved local deployment --- src/main/resources/application-local.yml | 2 +- stack/docker-compose.yml | 49 ++++++++++++++++++++++++ stack/pgadmin/pgpass | 1 + stack/pgadmin/servers.json | 14 +++++++ 4 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 stack/docker-compose.yml create mode 100644 stack/pgadmin/pgpass create mode 100644 stack/pgadmin/servers.json diff --git a/src/main/resources/application-local.yml b/src/main/resources/application-local.yml index 8431097..f275e0d 100644 --- a/src/main/resources/application-local.yml +++ b/src/main/resources/application-local.yml @@ -20,4 +20,4 @@ spring: auto: false logging: - config: classpath:logback-spring-local.xml \ No newline at end of file + config: classpath:logback-spring-local.xml diff --git a/stack/docker-compose.yml b/stack/docker-compose.yml new file mode 100644 index 0000000..794c7c6 --- /dev/null +++ b/stack/docker-compose.yml @@ -0,0 +1,49 @@ +name: ufo-stack + +services: + postgres: + container_name: ufo-postgres + image: postgres:16.4-alpine3.20@sha256:d898b0b78a2627cb4ee63464a14efc9d296884f1b28c841b0ab7d7c42f1fffdf + environment: + - POSTGRES_DB=kobit_local + - POSTGRES_USER=postgres + - POSTGRES_PASSWORD=postgres + ports: + - "5432:5432" + restart: &restart-policy on-failure:3 + healthcheck: &healthcheck + test: ["CMD-SHELL", "pg_isready -d postgres -U admin"] + interval: 30s + timeout: 60s + retries: 3 + start_period: 60s + security_opt: &security_settings + - no-new-privileges:true + + # see https://event-driven.io/en/automatically_connect_pgadmin_to_database/ + pg-admin: + container_name: ufo-pg-admin + image: dpage/pgadmin4:8.11@sha256:822dd7a1fa68601f70b3e06445c9cb52b134862b0c43f0f7a96ab6ac44a592a4 + environment: + - PGADMIN_DEFAULT_EMAIL=admin@admin.com + - PGADMIN_DEFAULT_PASSWORD=admin + - PGADMIN_CONFIG_SERVER_MODE=False + - PGADMIN_CONFIG_MASTER_PASSWORD_REQUIRED=False + - PGADMIN_LISTEN_PORT=5050 + ports: + - "5050:5050" + restart: *restart-policy + depends_on: + - postgres + healthcheck: + <<: *healthcheck + test: ["CMD", "wget", "-O", "-", "http://localhost:5050/misc/ping"] + security_opt: *security_settings + volumes: + - './pgadmin/servers.json:/pgadmin4/servers.json:ro' + - './pgadmin/pgpass:/pgadmin4/pgpass' + user: root # see https://github.com/pgadmin-org/pgadmin4/issues/6257 + entrypoint: /bin/sh -c "chmod 600 /pgadmin4/pgpass; /entrypoint.sh;" # see https://www.postgresql.org/docs/current/libpq-pgpass.html#LIBPQ-PGPASS (last paragraph) + +networks: + keycloak: diff --git a/stack/pgadmin/pgpass b/stack/pgadmin/pgpass new file mode 100644 index 0000000..fb2b4bc --- /dev/null +++ b/stack/pgadmin/pgpass @@ -0,0 +1 @@ +postgres:5432:*:admin:admin \ No newline at end of file diff --git a/stack/pgadmin/servers.json b/stack/pgadmin/servers.json new file mode 100644 index 0000000..a050a55 --- /dev/null +++ b/stack/pgadmin/servers.json @@ -0,0 +1,14 @@ +{ + "Servers": { + "1": { + "Name": "Postgres Docker", + "Group": "Servers", + "Host": "postgres", + "Port": 5432, + "MaintenanceDB": "postgres", + "Username": "admin", + "PassFile": "/pgadmin4/pgpass", + "SSLMode": "prefer" + } + } +} \ No newline at end of file From 1a00cdcef7dc87cabd9e095d4af4358f8cd346aa Mon Sep 17 00:00:00 2001 From: "jannik.lange" Date: Thu, 31 Oct 2024 16:46:47 +0100 Subject: [PATCH 11/25] :bug: bugfix for changing tree #42 --- .../repository/CompetenceRepository.java | 5 +- .../competence/service/CompetenceService.java | 13 ++++ .../ContactPointManipulationService.java | 62 +++++++++++++++---- .../relevance/repository/PathRepository.java | 8 ++- .../RelevanceCompetenceRepository.java | 2 + .../repository/RelevanceRepository.java | 2 + .../relevance/service/RelevanceService.java | 27 ++++++-- 7 files changed, 101 insertions(+), 18 deletions(-) diff --git a/src/main/java/de/muenchen/kobit/backend/competence/repository/CompetenceRepository.java b/src/main/java/de/muenchen/kobit/backend/competence/repository/CompetenceRepository.java index 2a912d1..f77ad5b 100644 --- a/src/main/java/de/muenchen/kobit/backend/competence/repository/CompetenceRepository.java +++ b/src/main/java/de/muenchen/kobit/backend/competence/repository/CompetenceRepository.java @@ -4,13 +4,13 @@ import de.muenchen.kobit.backend.competence.model.CompetenceToContactPoint; import de.muenchen.kobit.backend.competence.model.CompetenceToContactPointId; import java.util.List; +import java.util.Optional; import java.util.UUID; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @Repository -public interface CompetenceRepository - extends JpaRepository { +public interface CompetenceRepository extends JpaRepository { List findAllByCompetenceIn(List competences); List findAllByContactPointId(UUID contactPointId); @@ -18,4 +18,5 @@ public interface CompetenceRepository void deleteAllByContactPointId(UUID contactPointId); void deleteByContactPointIdAndCompetence(UUID contactPointId, Competence competence); + } diff --git a/src/main/java/de/muenchen/kobit/backend/competence/service/CompetenceService.java b/src/main/java/de/muenchen/kobit/backend/competence/service/CompetenceService.java index 6650540..9368ce2 100644 --- a/src/main/java/de/muenchen/kobit/backend/competence/service/CompetenceService.java +++ b/src/main/java/de/muenchen/kobit/backend/competence/service/CompetenceService.java @@ -11,6 +11,8 @@ import de.muenchen.kobit.backend.contactpoint.model.ContactPoint; import de.muenchen.kobit.backend.contactpoint.repository.ContactPointRepository; import de.muenchen.kobit.backend.contactpoint.view.ContactPointView; + +import java.lang.reflect.Array; import java.util.HashSet; import java.util.List; import java.util.Map; @@ -18,6 +20,8 @@ import java.util.Set; import java.util.UUID; import java.util.stream.Collectors; + +import de.muenchen.kobit.backend.decisiontree.relevance.model.RelevanceCompetence; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; @@ -86,6 +90,15 @@ private List getMatchingContactPoints(String department, Set .collect(toList()); } + // Extremly hacky workaround for trashy datastructure - please improve in the future + public Competence getCompetenceByEnumString(String enumAsString){ + String splittedString = enumAsString.split("\\.")[1].split("\\(")[0]; + + log.debug("getCompetenceByEnumString | splittedString {}", splittedString); + + return Competence.valueOf(splittedString); + } + @Transactional public void deleteCompetencesByContactPointId(UUID contactPointId) { competenceRepository.deleteAllByContactPointId(contactPointId); diff --git a/src/main/java/de/muenchen/kobit/backend/contactpoint/service/ContactPointManipulationService.java b/src/main/java/de/muenchen/kobit/backend/contactpoint/service/ContactPointManipulationService.java index 4cc0f08..9ff0f8c 100644 --- a/src/main/java/de/muenchen/kobit/backend/contactpoint/service/ContactPointManipulationService.java +++ b/src/main/java/de/muenchen/kobit/backend/contactpoint/service/ContactPointManipulationService.java @@ -10,8 +10,12 @@ import de.muenchen.kobit.backend.contact.view.ContactView; import de.muenchen.kobit.backend.contactpoint.model.ContactPoint; import de.muenchen.kobit.backend.contactpoint.repository.ContactPointRepository; +import de.muenchen.kobit.backend.contactpoint.view.ContactPointListItem; import de.muenchen.kobit.backend.contactpoint.view.ContactPointView; import de.muenchen.kobit.backend.contactpoint.view.ListItemToCompetenceView; +import de.muenchen.kobit.backend.decisiontree.relevance.model.Path; +import de.muenchen.kobit.backend.decisiontree.relevance.model.Relevance; +import de.muenchen.kobit.backend.decisiontree.relevance.model.RelevanceCompetence; import de.muenchen.kobit.backend.decisiontree.relevance.service.RelevanceService; import de.muenchen.kobit.backend.decisiontree.relevance.view.RelevanceOrder; import de.muenchen.kobit.backend.decisiontree.relevance.view.RelevanceView; @@ -22,11 +26,8 @@ import de.muenchen.kobit.backend.validation.exception.ContactPointValidationException; import de.muenchen.kobit.backend.validation.exception.contactpoint.InvalidCompetenceException; import de.muenchen.kobit.backend.validation.exception.contactpoint.InvalidContactPointException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.UUID; + +import java.util.*; import java.util.stream.Collectors; import javax.persistence.EntityNotFoundException; import org.slf4j.Logger; @@ -81,16 +82,55 @@ public void updateContactPointCompetence(List competen .getCompetences(); log.debug("updateContactPointCompetence | competences-size: {}", competences.size()); log.debug("updateContactPointCompetence | competences: {}", competences.toString()); - log.debug( - "updateContactPointCompetence | competencesViews: {}", competenceViews.toString()); - removeContactPointsForCompetence(competences); + log.debug("updateContactPointCompetence | competencesViews: {}", competenceViews.toString()); + /** + * For one cp (A) and curent Path (P) and Competences (COM) + * 1. Get all paths of A expect the P + * 2. Get a unique (optional) list of all the competences from all Paths from 1. + * 3. Get all competences COM of Path P + * 4. Subtract all competences (of 2.) from COM + * 5. Remove the competences of 4. from the contactpoint A + */ + competenceViews.forEach(competenceView -> removeUnusedCompetences(competenceView.getListItem(), competences)); + updateRelevance(competenceViews, competences); competenceViews.forEach( - it -> saveNewCompetencePair(it.getListItem().getId(), it.getCompetences())); + it -> saveNewCompetencePair(it.getListItem().getId(), it.getCompetences())); // set new competences for all + + + } + + private void removeUnusedCompetences(ContactPointListItem contactPointListItem, List competences) { + Path currentPath = relevanceService.getPath(new HashSet<>(competences)); + if (currentPath.equals(null)) { + return; + } + + + Set otherRelevanceCompetences = relevanceService.getAllRelevancesByContactPointId(contactPointListItem.getId()) + .stream() + .filter(relevance -> relevance.getPathId() != currentPath.getId()) + .map(relevance -> relevanceService.getAllRelevanceCompetencesByPathId(relevance.getPathId())) + .flatMap(Collection::stream) + .collect(Collectors.toSet()); + + + HashSet toRemove = new HashSet<>(currentPath.getCompetences()); + toRemove.removeAll(otherRelevanceCompetences); + + System.out.printf("The competences that need to be removed %s", toRemove.toString()); + log.debug("removeUnusedCompetences | toRemove: {}", toRemove.stream().map(RelevanceCompetence::getCompetence).collect(Collectors.toList()).toString()); + //List competencesToRemove = toRemove.stream().map(relevanceCompetence -> Competence.valueOf(relevanceCompetence.getCompetence())).collect(Collectors.toList()); + + List competencesToRemove = toRemove.stream() + .map(relevanceCompetence -> competenceService.getCompetenceByEnumString(relevanceCompetence.getCompetence())) + .collect(Collectors.toList()); + log.debug("removeUnusedCompetences | competencesToRemove: {}", competencesToRemove.toString()); + + competenceService.deleteCompetenceAndContactPointPair(contactPointListItem.getId(), competencesToRemove); } - private void updateRelevance( - List competenceViews, List competences) { + private void updateRelevance(List competenceViews, List competences) { relevanceService.setRelevanceOrder( new RelevanceView( new HashSet<>(competences), diff --git a/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/repository/PathRepository.java b/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/repository/PathRepository.java index 077a5cb..dd605ba 100644 --- a/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/repository/PathRepository.java +++ b/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/repository/PathRepository.java @@ -1,7 +1,13 @@ package de.muenchen.kobit.backend.decisiontree.relevance.repository; import de.muenchen.kobit.backend.decisiontree.relevance.model.Path; + +import java.util.Optional; import java.util.UUID; import org.springframework.data.jpa.repository.JpaRepository; -public interface PathRepository extends JpaRepository {} +public interface PathRepository extends JpaRepository { + + Optional findById(UUID uuid); + +} diff --git a/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/repository/RelevanceCompetenceRepository.java b/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/repository/RelevanceCompetenceRepository.java index 8a5414d..331ca08 100644 --- a/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/repository/RelevanceCompetenceRepository.java +++ b/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/repository/RelevanceCompetenceRepository.java @@ -10,4 +10,6 @@ public interface RelevanceCompetenceRepository extends JpaRepository { Optional findByCompetence(String competence); + + } diff --git a/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/repository/RelevanceRepository.java b/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/repository/RelevanceRepository.java index eab2f2e..7a51baa 100644 --- a/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/repository/RelevanceRepository.java +++ b/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/repository/RelevanceRepository.java @@ -13,4 +13,6 @@ public interface RelevanceRepository extends JpaRepository findAllByPathId(UUID pathId); + + List findAllByContactPointId(UUID contactPointId); } diff --git a/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/service/RelevanceService.java b/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/service/RelevanceService.java index 747b8a7..4edb51c 100644 --- a/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/service/RelevanceService.java +++ b/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/service/RelevanceService.java @@ -9,10 +9,8 @@ import de.muenchen.kobit.backend.decisiontree.relevance.repository.RelevanceRepository; import de.muenchen.kobit.backend.decisiontree.relevance.view.RelevanceOrder; import de.muenchen.kobit.backend.decisiontree.relevance.view.RelevanceView; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.UUID; + +import java.util.*; import java.util.stream.Collectors; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -33,6 +31,23 @@ public class RelevanceService { this.relevanceCompetenceRepository = relevanceCompetenceRepository; } + public List getAllRelevancesByContactPointId(UUID contactPointId) { + return relevanceRepository.findAllByContactPointId(contactPointId); + } + + + public Set getAllRelevanceCompetencesByPathId(UUID pathId) { + Optional path = pathRepository.findById(pathId); + + if (path.isPresent()) { + return path.get().getCompetences(); + } + + return new HashSet<>(); + } + + + public List getOrderOrNull(Set competences) { Path path = findExistingPathOrNull(competences); if (path == null) { @@ -44,6 +59,10 @@ public List getOrderOrNull(Set competences) { } } + public Path getPath(Set competences) { + return findExistingPathOrNull(competences); + } + @Transactional public void setRelevanceOrder(RelevanceView relevanceView) { Path matchingPath = findExistingPathOrNull(relevanceView.getPath()); From f5dbdb08fa55fe3a35a3a0a8d4342c4b25faae85 Mon Sep 17 00:00:00 2001 From: "jannik.lange" Date: Thu, 31 Oct 2024 16:50:15 +0100 Subject: [PATCH 12/25] :rotating_light: --- .../repository/CompetenceRepository.java | 5 +- .../competence/service/CompetenceService.java | 6 +- .../ContactPointManipulationService.java | 78 ++++++++++++------- .../relevance/repository/PathRepository.java | 2 - .../RelevanceCompetenceRepository.java | 2 - .../relevance/service/RelevanceService.java | 4 - 6 files changed, 51 insertions(+), 46 deletions(-) diff --git a/src/main/java/de/muenchen/kobit/backend/competence/repository/CompetenceRepository.java b/src/main/java/de/muenchen/kobit/backend/competence/repository/CompetenceRepository.java index f77ad5b..2a912d1 100644 --- a/src/main/java/de/muenchen/kobit/backend/competence/repository/CompetenceRepository.java +++ b/src/main/java/de/muenchen/kobit/backend/competence/repository/CompetenceRepository.java @@ -4,13 +4,13 @@ import de.muenchen.kobit.backend.competence.model.CompetenceToContactPoint; import de.muenchen.kobit.backend.competence.model.CompetenceToContactPointId; import java.util.List; -import java.util.Optional; import java.util.UUID; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.stereotype.Repository; @Repository -public interface CompetenceRepository extends JpaRepository { +public interface CompetenceRepository + extends JpaRepository { List findAllByCompetenceIn(List competences); List findAllByContactPointId(UUID contactPointId); @@ -18,5 +18,4 @@ public interface CompetenceRepository extends JpaRepository getMatchingContactPoints(String department, Set } // Extremly hacky workaround for trashy datastructure - please improve in the future - public Competence getCompetenceByEnumString(String enumAsString){ + public Competence getCompetenceByEnumString(String enumAsString) { String splittedString = enumAsString.split("\\.")[1].split("\\(")[0]; log.debug("getCompetenceByEnumString | splittedString {}", splittedString); diff --git a/src/main/java/de/muenchen/kobit/backend/contactpoint/service/ContactPointManipulationService.java b/src/main/java/de/muenchen/kobit/backend/contactpoint/service/ContactPointManipulationService.java index 9ff0f8c..8ee5918 100644 --- a/src/main/java/de/muenchen/kobit/backend/contactpoint/service/ContactPointManipulationService.java +++ b/src/main/java/de/muenchen/kobit/backend/contactpoint/service/ContactPointManipulationService.java @@ -14,7 +14,6 @@ import de.muenchen.kobit.backend.contactpoint.view.ContactPointView; import de.muenchen.kobit.backend.contactpoint.view.ListItemToCompetenceView; import de.muenchen.kobit.backend.decisiontree.relevance.model.Path; -import de.muenchen.kobit.backend.decisiontree.relevance.model.Relevance; import de.muenchen.kobit.backend.decisiontree.relevance.model.RelevanceCompetence; import de.muenchen.kobit.backend.decisiontree.relevance.service.RelevanceService; import de.muenchen.kobit.backend.decisiontree.relevance.view.RelevanceOrder; @@ -26,7 +25,6 @@ import de.muenchen.kobit.backend.validation.exception.ContactPointValidationException; import de.muenchen.kobit.backend.validation.exception.contactpoint.InvalidCompetenceException; import de.muenchen.kobit.backend.validation.exception.contactpoint.InvalidContactPointException; - import java.util.*; import java.util.stream.Collectors; import javax.persistence.EntityNotFoundException; @@ -82,55 +80,75 @@ public void updateContactPointCompetence(List competen .getCompetences(); log.debug("updateContactPointCompetence | competences-size: {}", competences.size()); log.debug("updateContactPointCompetence | competences: {}", competences.toString()); - log.debug("updateContactPointCompetence | competencesViews: {}", competenceViews.toString()); + log.debug( + "updateContactPointCompetence | competencesViews: {}", competenceViews.toString()); /** - * For one cp (A) and curent Path (P) and Competences (COM) - * 1. Get all paths of A expect the P - * 2. Get a unique (optional) list of all the competences from all Paths from 1. - * 3. Get all competences COM of Path P - * 4. Subtract all competences (of 2.) from COM - * 5. Remove the competences of 4. from the contactpoint A + * For one cp (A) and curent Path (P) and Competences (COM) 1. Get all paths of A expect the + * P 2. Get a unique (optional) list of all the competences from all Paths from 1. 3. Get + * all competences COM of Path P 4. Subtract all competences (of 2.) from COM 5. Remove the + * competences of 4. from the contactpoint A */ - competenceViews.forEach(competenceView -> removeUnusedCompetences(competenceView.getListItem(), competences)); + competenceViews.forEach( + competenceView -> + removeUnusedCompetences(competenceView.getListItem(), competences)); updateRelevance(competenceViews, competences); competenceViews.forEach( - it -> saveNewCompetencePair(it.getListItem().getId(), it.getCompetences())); // set new competences for all - - + it -> + saveNewCompetencePair( + it.getListItem().getId(), + it.getCompetences())); // set new competences for all } - private void removeUnusedCompetences(ContactPointListItem contactPointListItem, List competences) { + private void removeUnusedCompetences( + ContactPointListItem contactPointListItem, List competences) { Path currentPath = relevanceService.getPath(new HashSet<>(competences)); if (currentPath.equals(null)) { return; } - - Set otherRelevanceCompetences = relevanceService.getAllRelevancesByContactPointId(contactPointListItem.getId()) - .stream() - .filter(relevance -> relevance.getPathId() != currentPath.getId()) - .map(relevance -> relevanceService.getAllRelevanceCompetencesByPathId(relevance.getPathId())) - .flatMap(Collection::stream) - .collect(Collectors.toSet()); - + Set otherRelevanceCompetences = + relevanceService + .getAllRelevancesByContactPointId(contactPointListItem.getId()) + .stream() + .filter(relevance -> relevance.getPathId() != currentPath.getId()) + .map( + relevance -> + relevanceService.getAllRelevanceCompetencesByPathId( + relevance.getPathId())) + .flatMap(Collection::stream) + .collect(Collectors.toSet()); HashSet toRemove = new HashSet<>(currentPath.getCompetences()); toRemove.removeAll(otherRelevanceCompetences); System.out.printf("The competences that need to be removed %s", toRemove.toString()); - log.debug("removeUnusedCompetences | toRemove: {}", toRemove.stream().map(RelevanceCompetence::getCompetence).collect(Collectors.toList()).toString()); - //List competencesToRemove = toRemove.stream().map(relevanceCompetence -> Competence.valueOf(relevanceCompetence.getCompetence())).collect(Collectors.toList()); + log.debug( + "removeUnusedCompetences | toRemove: {}", + toRemove.stream() + .map(RelevanceCompetence::getCompetence) + .collect(Collectors.toList()) + .toString()); + // List competencesToRemove = toRemove.stream().map(relevanceCompetence -> + // Competence.valueOf(relevanceCompetence.getCompetence())).collect(Collectors.toList()); - List competencesToRemove = toRemove.stream() - .map(relevanceCompetence -> competenceService.getCompetenceByEnumString(relevanceCompetence.getCompetence())) - .collect(Collectors.toList()); - log.debug("removeUnusedCompetences | competencesToRemove: {}", competencesToRemove.toString()); + List competencesToRemove = + toRemove.stream() + .map( + relevanceCompetence -> + competenceService.getCompetenceByEnumString( + relevanceCompetence.getCompetence())) + .collect(Collectors.toList()); + log.debug( + "removeUnusedCompetences | competencesToRemove: {}", + competencesToRemove.toString()); - competenceService.deleteCompetenceAndContactPointPair(contactPointListItem.getId(), competencesToRemove); + competenceService.deleteCompetenceAndContactPointPair( + contactPointListItem.getId(), competencesToRemove); } - private void updateRelevance(List competenceViews, List competences) { + private void updateRelevance( + List competenceViews, List competences) { relevanceService.setRelevanceOrder( new RelevanceView( new HashSet<>(competences), diff --git a/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/repository/PathRepository.java b/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/repository/PathRepository.java index dd605ba..5ffaba7 100644 --- a/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/repository/PathRepository.java +++ b/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/repository/PathRepository.java @@ -1,7 +1,6 @@ package de.muenchen.kobit.backend.decisiontree.relevance.repository; import de.muenchen.kobit.backend.decisiontree.relevance.model.Path; - import java.util.Optional; import java.util.UUID; import org.springframework.data.jpa.repository.JpaRepository; @@ -9,5 +8,4 @@ public interface PathRepository extends JpaRepository { Optional findById(UUID uuid); - } diff --git a/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/repository/RelevanceCompetenceRepository.java b/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/repository/RelevanceCompetenceRepository.java index 331ca08..8a5414d 100644 --- a/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/repository/RelevanceCompetenceRepository.java +++ b/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/repository/RelevanceCompetenceRepository.java @@ -10,6 +10,4 @@ public interface RelevanceCompetenceRepository extends JpaRepository { Optional findByCompetence(String competence); - - } diff --git a/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/service/RelevanceService.java b/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/service/RelevanceService.java index 4edb51c..bf274bc 100644 --- a/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/service/RelevanceService.java +++ b/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/service/RelevanceService.java @@ -9,7 +9,6 @@ import de.muenchen.kobit.backend.decisiontree.relevance.repository.RelevanceRepository; import de.muenchen.kobit.backend.decisiontree.relevance.view.RelevanceOrder; import de.muenchen.kobit.backend.decisiontree.relevance.view.RelevanceView; - import java.util.*; import java.util.stream.Collectors; import org.springframework.stereotype.Service; @@ -35,7 +34,6 @@ public List getAllRelevancesByContactPointId(UUID contactPointId) { return relevanceRepository.findAllByContactPointId(contactPointId); } - public Set getAllRelevanceCompetencesByPathId(UUID pathId) { Optional path = pathRepository.findById(pathId); @@ -46,8 +44,6 @@ public Set getAllRelevanceCompetencesByPathId(UUID pathId) return new HashSet<>(); } - - public List getOrderOrNull(Set competences) { Path path = findExistingPathOrNull(competences); if (path == null) { From 57f68fc12ff7a360434b01443a2bfd345a98a897 Mon Sep 17 00:00:00 2001 From: "jannik.lange" Date: Wed, 13 Nov 2024 09:50:21 +0100 Subject: [PATCH 13/25] :bug: fixing null check --- .../service/ContactPointManipulationService.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/main/java/de/muenchen/kobit/backend/contactpoint/service/ContactPointManipulationService.java b/src/main/java/de/muenchen/kobit/backend/contactpoint/service/ContactPointManipulationService.java index 8ee5918..2d29794 100644 --- a/src/main/java/de/muenchen/kobit/backend/contactpoint/service/ContactPointManipulationService.java +++ b/src/main/java/de/muenchen/kobit/backend/contactpoint/service/ContactPointManipulationService.java @@ -100,12 +100,13 @@ public void updateContactPointCompetence(List competen it.getCompetences())); // set new competences for all } - private void removeUnusedCompetences( - ContactPointListItem contactPointListItem, List competences) { + private void removeUnusedCompetences(ContactPointListItem contactPointListItem, List competences) { + log.debug("removeUnusedCompetences | competences: {}", competences.toString()); Path currentPath = relevanceService.getPath(new HashSet<>(competences)); - if (currentPath.equals(null)) { + if (currentPath ==null) { return; } + log.debug("removeUnusedCompetences | currentPath: {}", currentPath.toString()); Set otherRelevanceCompetences = relevanceService From 5dcc6bc11b576d5debe5392986b8d349377c7408 Mon Sep 17 00:00:00 2001 From: "jannik.lange" Date: Wed, 13 Nov 2024 10:36:11 +0100 Subject: [PATCH 14/25] :art: spotless --- .../service/ContactPointManipulationService.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/muenchen/kobit/backend/contactpoint/service/ContactPointManipulationService.java b/src/main/java/de/muenchen/kobit/backend/contactpoint/service/ContactPointManipulationService.java index 2d29794..6b22ce5 100644 --- a/src/main/java/de/muenchen/kobit/backend/contactpoint/service/ContactPointManipulationService.java +++ b/src/main/java/de/muenchen/kobit/backend/contactpoint/service/ContactPointManipulationService.java @@ -100,10 +100,11 @@ public void updateContactPointCompetence(List competen it.getCompetences())); // set new competences for all } - private void removeUnusedCompetences(ContactPointListItem contactPointListItem, List competences) { + private void removeUnusedCompetences( + ContactPointListItem contactPointListItem, List competences) { log.debug("removeUnusedCompetences | competences: {}", competences.toString()); Path currentPath = relevanceService.getPath(new HashSet<>(competences)); - if (currentPath ==null) { + if (currentPath == null) { return; } log.debug("removeUnusedCompetences | currentPath: {}", currentPath.toString()); From 602953886eec466050958d475c1185ebea69038d Mon Sep 17 00:00:00 2001 From: "jannik.lange" Date: Wed, 13 Nov 2024 16:15:45 +0100 Subject: [PATCH 15/25] :bug: fixed equals bug --- .../ContactPointManipulationService.java | 49 +++++++++++++++---- .../RelevanceCompetenceRepository.java | 2 + .../relevance/service/RelevanceService.java | 3 ++ 3 files changed, 44 insertions(+), 10 deletions(-) diff --git a/src/main/java/de/muenchen/kobit/backend/contactpoint/service/ContactPointManipulationService.java b/src/main/java/de/muenchen/kobit/backend/contactpoint/service/ContactPointManipulationService.java index 6b22ce5..3fdb47b 100644 --- a/src/main/java/de/muenchen/kobit/backend/contactpoint/service/ContactPointManipulationService.java +++ b/src/main/java/de/muenchen/kobit/backend/contactpoint/service/ContactPointManipulationService.java @@ -14,6 +14,7 @@ import de.muenchen.kobit.backend.contactpoint.view.ContactPointView; import de.muenchen.kobit.backend.contactpoint.view.ListItemToCompetenceView; import de.muenchen.kobit.backend.decisiontree.relevance.model.Path; +import de.muenchen.kobit.backend.decisiontree.relevance.model.Relevance; import de.muenchen.kobit.backend.decisiontree.relevance.model.RelevanceCompetence; import de.muenchen.kobit.backend.decisiontree.relevance.service.RelevanceService; import de.muenchen.kobit.backend.decisiontree.relevance.view.RelevanceOrder; @@ -88,9 +89,20 @@ public void updateContactPointCompetence(List competen * all competences COM of Path P 4. Subtract all competences (of 2.) from COM 5. Remove the * competences of 4. from the contactpoint A */ - competenceViews.forEach( + + // TODO - find out which cp was deleted by comparing the paths - much like in updating relevances - does this only need to be executed for deleted cps? + + List cpToUpdate = getContactPointsToUpdate(competenceViews, competences); + + log.debug("updateContactPointCompetence | cps: {}", cpToUpdate.toString()); + + cpToUpdate.forEach( + cp -> removeUnusedCompetences(cp, competences) + ); + + /* competenceViews.forEach( competenceView -> - removeUnusedCompetences(competenceView.getListItem(), competences)); + removeUnusedCompetences(competenceView.getListItem(), competences));*/ updateRelevance(competenceViews, competences); competenceViews.forEach( @@ -100,39 +112,56 @@ public void updateContactPointCompetence(List competen it.getCompetences())); // set new competences for all } + private List getContactPointsToUpdate(List competenceViews, List competences) { + Path currentPath = relevanceService.getPath(new HashSet<>(competences)); + if (currentPath == null) { + return Collections.emptyList(); + } + + List currentCPIds = relevanceService.getAllRelevancesByPathId(currentPath.getId()).stream().map(Relevance::getContactPointId).collect(Collectors.toList()); + log.debug("getContactPointsToUpdate | currentCPIds: {}", currentCPIds); + + List receivedCPIds = competenceViews.stream().map(cpv -> cpv.getListItem().getId()).collect(Collectors.toList()); + log.debug("getContactPointsToUpdate | receivedCPIds: {}", receivedCPIds); + + currentCPIds.removeAll(receivedCPIds); + + return currentCPIds; + } + private void removeUnusedCompetences( - ContactPointListItem contactPointListItem, List competences) { + UUID cpID, List competences) { log.debug("removeUnusedCompetences | competences: {}", competences.toString()); Path currentPath = relevanceService.getPath(new HashSet<>(competences)); if (currentPath == null) { return; } - log.debug("removeUnusedCompetences | currentPath: {}", currentPath.toString()); + log.debug("removeUnusedCompetences | currentPath: {}", currentPath.getId().toString()); Set otherRelevanceCompetences = relevanceService - .getAllRelevancesByContactPointId(contactPointListItem.getId()) + .getAllRelevancesByContactPointId(cpID) .stream() - .filter(relevance -> relevance.getPathId() != currentPath.getId()) + .filter(relevance -> !relevance.getPathId().equals(currentPath.getId())) .map( relevance -> relevanceService.getAllRelevanceCompetencesByPathId( relevance.getPathId())) .flatMap(Collection::stream) .collect(Collectors.toSet()); + log.debug("removeUnusedCompetences | otherRelevanceCompetences: {}", otherRelevanceCompetences.stream().map(RelevanceCompetence::getId).collect(Collectors.toList())); HashSet toRemove = new HashSet<>(currentPath.getCompetences()); + log.debug("removeUnusedCompetences | toRemove: {}", toRemove.stream().map(RelevanceCompetence::getId).collect(Collectors.toList())); + toRemove.removeAll(otherRelevanceCompetences); - System.out.printf("The competences that need to be removed %s", toRemove.toString()); log.debug( "removeUnusedCompetences | toRemove: {}", toRemove.stream() .map(RelevanceCompetence::getCompetence) .collect(Collectors.toList()) .toString()); - // List competencesToRemove = toRemove.stream().map(relevanceCompetence -> - // Competence.valueOf(relevanceCompetence.getCompetence())).collect(Collectors.toList()); List competencesToRemove = toRemove.stream() @@ -146,7 +175,7 @@ private void removeUnusedCompetences( competencesToRemove.toString()); competenceService.deleteCompetenceAndContactPointPair( - contactPointListItem.getId(), competencesToRemove); + cpID, competencesToRemove); } private void updateRelevance( diff --git a/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/repository/RelevanceCompetenceRepository.java b/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/repository/RelevanceCompetenceRepository.java index 8a5414d..32dec5e 100644 --- a/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/repository/RelevanceCompetenceRepository.java +++ b/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/repository/RelevanceCompetenceRepository.java @@ -1,6 +1,8 @@ package de.muenchen.kobit.backend.decisiontree.relevance.repository; import de.muenchen.kobit.backend.decisiontree.relevance.model.RelevanceCompetence; + +import java.util.List; import java.util.Optional; import java.util.UUID; import org.springframework.data.jpa.repository.JpaRepository; diff --git a/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/service/RelevanceService.java b/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/service/RelevanceService.java index bf274bc..dd24a45 100644 --- a/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/service/RelevanceService.java +++ b/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/service/RelevanceService.java @@ -33,6 +33,9 @@ public class RelevanceService { public List getAllRelevancesByContactPointId(UUID contactPointId) { return relevanceRepository.findAllByContactPointId(contactPointId); } + public List getAllRelevancesByPathId(UUID pathId) { + return relevanceRepository.findAllByPathId(pathId); + } public Set getAllRelevanceCompetencesByPathId(UUID pathId) { Optional path = pathRepository.findById(pathId); From 4be1022bc3c65f87c603912811aacc415fdc8db1 Mon Sep 17 00:00:00 2001 From: "jannik.lange" Date: Wed, 13 Nov 2024 16:22:23 +0100 Subject: [PATCH 16/25] :art: spotless --- .../ContactPointManipulationService.java | 45 +++++++++++-------- .../RelevanceCompetenceRepository.java | 2 - .../relevance/service/RelevanceService.java | 1 + 3 files changed, 27 insertions(+), 21 deletions(-) diff --git a/src/main/java/de/muenchen/kobit/backend/contactpoint/service/ContactPointManipulationService.java b/src/main/java/de/muenchen/kobit/backend/contactpoint/service/ContactPointManipulationService.java index 3fdb47b..a4d0b36 100644 --- a/src/main/java/de/muenchen/kobit/backend/contactpoint/service/ContactPointManipulationService.java +++ b/src/main/java/de/muenchen/kobit/backend/contactpoint/service/ContactPointManipulationService.java @@ -10,7 +10,6 @@ import de.muenchen.kobit.backend.contact.view.ContactView; import de.muenchen.kobit.backend.contactpoint.model.ContactPoint; import de.muenchen.kobit.backend.contactpoint.repository.ContactPointRepository; -import de.muenchen.kobit.backend.contactpoint.view.ContactPointListItem; import de.muenchen.kobit.backend.contactpoint.view.ContactPointView; import de.muenchen.kobit.backend.contactpoint.view.ListItemToCompetenceView; import de.muenchen.kobit.backend.decisiontree.relevance.model.Path; @@ -90,19 +89,18 @@ public void updateContactPointCompetence(List competen * competences of 4. from the contactpoint A */ - // TODO - find out which cp was deleted by comparing the paths - much like in updating relevances - does this only need to be executed for deleted cps? + // TODO - find out which cp was deleted by comparing the paths - much like in updating + // relevances - does this only need to be executed for deleted cps? List cpToUpdate = getContactPointsToUpdate(competenceViews, competences); log.debug("updateContactPointCompetence | cps: {}", cpToUpdate.toString()); - cpToUpdate.forEach( - cp -> removeUnusedCompetences(cp, competences) - ); + cpToUpdate.forEach(cp -> removeUnusedCompetences(cp, competences)); /* competenceViews.forEach( - competenceView -> - removeUnusedCompetences(competenceView.getListItem(), competences));*/ + competenceView -> + removeUnusedCompetences(competenceView.getListItem(), competences));*/ updateRelevance(competenceViews, competences); competenceViews.forEach( @@ -112,16 +110,23 @@ public void updateContactPointCompetence(List competen it.getCompetences())); // set new competences for all } - private List getContactPointsToUpdate(List competenceViews, List competences) { + private List getContactPointsToUpdate( + List competenceViews, List competences) { Path currentPath = relevanceService.getPath(new HashSet<>(competences)); if (currentPath == null) { return Collections.emptyList(); } - List currentCPIds = relevanceService.getAllRelevancesByPathId(currentPath.getId()).stream().map(Relevance::getContactPointId).collect(Collectors.toList()); + List currentCPIds = + relevanceService.getAllRelevancesByPathId(currentPath.getId()).stream() + .map(Relevance::getContactPointId) + .collect(Collectors.toList()); log.debug("getContactPointsToUpdate | currentCPIds: {}", currentCPIds); - List receivedCPIds = competenceViews.stream().map(cpv -> cpv.getListItem().getId()).collect(Collectors.toList()); + List receivedCPIds = + competenceViews.stream() + .map(cpv -> cpv.getListItem().getId()) + .collect(Collectors.toList()); log.debug("getContactPointsToUpdate | receivedCPIds: {}", receivedCPIds); currentCPIds.removeAll(receivedCPIds); @@ -129,8 +134,7 @@ private List getContactPointsToUpdate(List compe return currentCPIds; } - private void removeUnusedCompetences( - UUID cpID, List competences) { + private void removeUnusedCompetences(UUID cpID, List competences) { log.debug("removeUnusedCompetences | competences: {}", competences.toString()); Path currentPath = relevanceService.getPath(new HashSet<>(competences)); if (currentPath == null) { @@ -139,9 +143,7 @@ private void removeUnusedCompetences( log.debug("removeUnusedCompetences | currentPath: {}", currentPath.getId().toString()); Set otherRelevanceCompetences = - relevanceService - .getAllRelevancesByContactPointId(cpID) - .stream() + relevanceService.getAllRelevancesByContactPointId(cpID).stream() .filter(relevance -> !relevance.getPathId().equals(currentPath.getId())) .map( relevance -> @@ -149,10 +151,16 @@ private void removeUnusedCompetences( relevance.getPathId())) .flatMap(Collection::stream) .collect(Collectors.toSet()); - log.debug("removeUnusedCompetences | otherRelevanceCompetences: {}", otherRelevanceCompetences.stream().map(RelevanceCompetence::getId).collect(Collectors.toList())); + log.debug( + "removeUnusedCompetences | otherRelevanceCompetences: {}", + otherRelevanceCompetences.stream() + .map(RelevanceCompetence::getId) + .collect(Collectors.toList())); HashSet toRemove = new HashSet<>(currentPath.getCompetences()); - log.debug("removeUnusedCompetences | toRemove: {}", toRemove.stream().map(RelevanceCompetence::getId).collect(Collectors.toList())); + log.debug( + "removeUnusedCompetences | toRemove: {}", + toRemove.stream().map(RelevanceCompetence::getId).collect(Collectors.toList())); toRemove.removeAll(otherRelevanceCompetences); @@ -174,8 +182,7 @@ private void removeUnusedCompetences( "removeUnusedCompetences | competencesToRemove: {}", competencesToRemove.toString()); - competenceService.deleteCompetenceAndContactPointPair( - cpID, competencesToRemove); + competenceService.deleteCompetenceAndContactPointPair(cpID, competencesToRemove); } private void updateRelevance( diff --git a/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/repository/RelevanceCompetenceRepository.java b/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/repository/RelevanceCompetenceRepository.java index 32dec5e..8a5414d 100644 --- a/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/repository/RelevanceCompetenceRepository.java +++ b/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/repository/RelevanceCompetenceRepository.java @@ -1,8 +1,6 @@ package de.muenchen.kobit.backend.decisiontree.relevance.repository; import de.muenchen.kobit.backend.decisiontree.relevance.model.RelevanceCompetence; - -import java.util.List; import java.util.Optional; import java.util.UUID; import org.springframework.data.jpa.repository.JpaRepository; diff --git a/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/service/RelevanceService.java b/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/service/RelevanceService.java index dd24a45..ec857d5 100644 --- a/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/service/RelevanceService.java +++ b/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/service/RelevanceService.java @@ -33,6 +33,7 @@ public class RelevanceService { public List getAllRelevancesByContactPointId(UUID contactPointId) { return relevanceRepository.findAllByContactPointId(contactPointId); } + public List getAllRelevancesByPathId(UUID pathId) { return relevanceRepository.findAllByPathId(pathId); } From 90a4e2df996c5f6fdee3495e122016fe8c7ec64a Mon Sep 17 00:00:00 2001 From: "jannik.lange" Date: Thu, 14 Nov 2024 09:55:07 +0100 Subject: [PATCH 17/25] configurable logback-path --- src/main/resources/application.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 91e122a..c598e53 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -79,4 +79,7 @@ info.application.version: @project.version@ tomcat: gracefulshutdown: - enabled: false \ No newline at end of file + enabled: false + +logging: + config: ${LOGBACK_PATH:classpath:logback-spring.xml} From f0f2efc9fa4da18d7421263004cc928aa1963a0d Mon Sep 17 00:00:00 2001 From: "jannik.lange" Date: Thu, 14 Nov 2024 11:26:40 +0100 Subject: [PATCH 18/25] banner logback information --- src/main/resources/banner.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/resources/banner.txt b/src/main/resources/banner.txt index 57b46fc..014b775 100644 --- a/src/main/resources/banner.txt +++ b/src/main/resources/banner.txt @@ -21,4 +21,5 @@ KKKKKKKKK KKKKKKK ooooooooooo BBBBBBBBBBBBBBBBB IIIIIIIIII TTTTTTT Application Name : ${spring.application.name} Spring Boot Version : ${spring-boot.formatted-version} + Logback : ${logging.config} --------------------------------------------------------------------------------------------------------------------------------------------------- From 79d79c87602d61125a3060edd958939c5499b3fd Mon Sep 17 00:00:00 2001 From: "jannik.lange" Date: Tue, 3 Dec 2024 15:03:33 +0100 Subject: [PATCH 19/25] reworked CompetenceService --- .../competence/service/CompetenceService.java | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/main/java/de/muenchen/kobit/backend/competence/service/CompetenceService.java b/src/main/java/de/muenchen/kobit/backend/competence/service/CompetenceService.java index f36dc71..e8d0fde 100644 --- a/src/main/java/de/muenchen/kobit/backend/competence/service/CompetenceService.java +++ b/src/main/java/de/muenchen/kobit/backend/competence/service/CompetenceService.java @@ -18,6 +18,7 @@ import java.util.Set; import java.util.UUID; import java.util.stream.Collectors; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; @@ -40,23 +41,14 @@ public class CompetenceService { this.mapper = mapper; } - public List findAllContactPointsForCompetences( + public List findAllContactPointsForCompetences(List foundCPs, List competences, String department) { - Set keys = getContactPointIds(competences); + Set keys = new HashSet<>(foundCPs); if (isSpecialCase(competences)) { keys.addAll(specialCaseContactPoints(competences)); } - return getMatchingContactPoints(department, keys).stream() - .map(mapper::contactPointToView) - .collect(Collectors.toList()); - } - public List findAllContactPointsForCompetences(List competences) { - Set keys = getContactPointIds(competences); - if (isSpecialCase(competences)) { - keys.addAll(specialCaseContactPoints(competences)); - } - return contactPointRepository.findAllByIdIn(keys).stream() + return getMatchingContactPoints(department, keys).stream() .map(mapper::contactPointToView) .collect(Collectors.toList()); } @@ -68,6 +60,7 @@ public List findAllCompetencesForId(UUID contactPointId) { } private List getMatchingContactPoints(String department, Set keys) { + log.debug("getMatchingContactPoints | department {}", department); if (department == null) { return keys.stream() @@ -107,6 +100,7 @@ public void deleteCompetenceAndContactPointPair( it -> competenceRepository.deleteByContactPointIdAndCompetence(contactPointId, it)); } + @Transactional public void createCompetenceToContactPoint(UUID contactPointId, Competence competence) { createCompetenceToContactPoint(new CompetenceToContactPoint(contactPointId, competence)); } From b3b977599fc13144e7a0d0c7ad5f20490696035d Mon Sep 17 00:00:00 2001 From: "jannik.lange" Date: Tue, 3 Dec 2024 15:04:31 +0100 Subject: [PATCH 20/25] :fire: removed special cases of contactpoints --- .../competence/service/CompetenceService.java | 30 ------------------- 1 file changed, 30 deletions(-) diff --git a/src/main/java/de/muenchen/kobit/backend/competence/service/CompetenceService.java b/src/main/java/de/muenchen/kobit/backend/competence/service/CompetenceService.java index e8d0fde..2900195 100644 --- a/src/main/java/de/muenchen/kobit/backend/competence/service/CompetenceService.java +++ b/src/main/java/de/muenchen/kobit/backend/competence/service/CompetenceService.java @@ -44,9 +44,6 @@ public class CompetenceService { public List findAllContactPointsForCompetences(List foundCPs, List competences, String department) { Set keys = new HashSet<>(foundCPs); - if (isSpecialCase(competences)) { - keys.addAll(specialCaseContactPoints(competences)); - } return getMatchingContactPoints(department, keys).stream() .map(mapper::contactPointToView) @@ -127,31 +124,4 @@ private Set getContactPointIds(List competences) { } return matchingKeys; } - - /** - * @param competences - list of competences selected in the decision tree - * @return true if a special case is given A special case are some contact points for juniors. - * These are not only responsible for the Juniors, they are also responsible if an executive - * or employee has a problem with a junior. - */ - private boolean isSpecialCase(List competences) { - return ((competences.contains(Competence.EXECUTIVE) - && competences.contains(Competence.OPPOSITE_JUNIOR)) - || (competences.contains(Competence.EMPLOYEE) - && competences.contains(Competence.OPPOSITE_JUNIOR))); - } - - private Set specialCaseContactPoints(List competences) { - if (competences.contains(Competence.EXECUTIVE) - && competences.contains(Competence.OPPOSITE_JUNIOR)) { - competences.remove(Competence.EXECUTIVE); - competences.add(Competence.EXECUTIVE_JUNIOR); - } - if (competences.contains(Competence.EMPLOYEE) - && competences.contains(Competence.OPPOSITE_JUNIOR)) { - competences.remove(Competence.EMPLOYEE); - competences.add(Competence.EMPLOYEE_JUNIOR); - } - return getContactPointIds(competences); - } } From 1e588a4cae37827ea1eba1f1bbd689fa13c3cf01 Mon Sep 17 00:00:00 2001 From: "jannik.lange" Date: Tue, 3 Dec 2024 15:05:36 +0100 Subject: [PATCH 21/25] updated manipulationservice --- .../ContactPointManipulationService.java | 23 +++++-------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/src/main/java/de/muenchen/kobit/backend/contactpoint/service/ContactPointManipulationService.java b/src/main/java/de/muenchen/kobit/backend/contactpoint/service/ContactPointManipulationService.java index a4d0b36..2dbf3c8 100644 --- a/src/main/java/de/muenchen/kobit/backend/contactpoint/service/ContactPointManipulationService.java +++ b/src/main/java/de/muenchen/kobit/backend/contactpoint/service/ContactPointManipulationService.java @@ -89,12 +89,9 @@ public void updateContactPointCompetence(List competen * competences of 4. from the contactpoint A */ - // TODO - find out which cp was deleted by comparing the paths - much like in updating - // relevances - does this only need to be executed for deleted cps? - List cpToUpdate = getContactPointsToUpdate(competenceViews, competences); - log.debug("updateContactPointCompetence | cps: {}", cpToUpdate.toString()); + log.debug("updateContactPointCompetence | CPs to update: {}", cpToUpdate.toString()); cpToUpdate.forEach(cp -> removeUnusedCompetences(cp, competences)); @@ -102,12 +99,12 @@ public void updateContactPointCompetence(List competen competenceView -> removeUnusedCompetences(competenceView.getListItem(), competences));*/ - updateRelevance(competenceViews, competences); competenceViews.forEach( - it -> + listItemToCompetenceView -> saveNewCompetencePair( - it.getListItem().getId(), - it.getCompetences())); // set new competences for all + listItemToCompetenceView.getListItem().getId(), + listItemToCompetenceView.getCompetences())); // set new competences for all + updateRelevance(competenceViews, competences); } private List getContactPointsToUpdate( @@ -116,6 +113,7 @@ private List getContactPointsToUpdate( if (currentPath == null) { return Collections.emptyList(); } + log.debug("cpManipulation | pathID: {}", currentPath.getId()); List currentCPIds = relevanceService.getAllRelevancesByPathId(currentPath.getId()).stream() @@ -241,15 +239,6 @@ private void validateId(UUID contactPointId, UUID pathID) throws InvalidContactP } } - private void removeContactPointsForCompetence(List competences) { - List existingCompetences = - competenceService.findAllContactPointsForCompetences(competences); - existingCompetences.forEach( - it -> - competenceService.deleteCompetenceAndContactPointPair( - it.getId(), competences)); - } - private void saveNewCompetencePair(UUID id, List competences) { for (Competence competence : competences) { competenceService.createCompetenceToContactPoint(id, competence); From 88eb352848b3e0c338afda9fe6effd989ee0fce3 Mon Sep 17 00:00:00 2001 From: "jannik.lange" Date: Tue, 3 Dec 2024 15:06:08 +0100 Subject: [PATCH 22/25] updated decisiontreeservice --- .../service/DecisionTreeService.java | 44 +++++++++++++------ 1 file changed, 30 insertions(+), 14 deletions(-) diff --git a/src/main/java/de/muenchen/kobit/backend/decisiontree/service/DecisionTreeService.java b/src/main/java/de/muenchen/kobit/backend/decisiontree/service/DecisionTreeService.java index cfaa9ed..eed078a 100644 --- a/src/main/java/de/muenchen/kobit/backend/decisiontree/service/DecisionTreeService.java +++ b/src/main/java/de/muenchen/kobit/backend/decisiontree/service/DecisionTreeService.java @@ -9,6 +9,7 @@ import de.muenchen.kobit.backend.decisiontree.branches.MobbingBranch; import de.muenchen.kobit.backend.decisiontree.branches.Root; import de.muenchen.kobit.backend.decisiontree.branches.WorkConflictBranch; +import de.muenchen.kobit.backend.decisiontree.relevance.model.Path; import de.muenchen.kobit.backend.decisiontree.relevance.service.RelevanceService; import de.muenchen.kobit.backend.decisiontree.relevance.view.RelevanceOrder; import de.muenchen.kobit.backend.decisiontree.view.DecisionContactPointWrapper; @@ -61,6 +62,7 @@ public class DecisionTreeService { @Transactional(readOnly = true) public DecisionContactPointWrapper getNextDecisionPointOrContactPoints( List selectedCompetences, String department) { + if (selectedCompetences.isEmpty()) { return getRoot(); } @@ -75,11 +77,22 @@ public DecisionContactPointWrapper getNextDecisionPointOrContactPoints( Competence lastSelectedDecision = getLastElement(selectedCompetences); DecisionPoint result = getNextDecisionPointOrNull(lastSelectedDecision, rootSelection); if (result == null) { - return new DecisionContactPointWrapper( - order( - competenceService.findAllContactPointsForCompetences( - selectedCompetences, department), - selectedCompetences)); + Path path = relevanceService.getPath(new HashSet<>(selectedCompetences)); + + List foundCPIds = new ArrayList<>(); + if (path != null) { + foundCPIds.addAll(relevanceService.getAllContactPointIdsByPathId(path.getId())); + log.debug("getNextDecisionPointOrContactPoints | found CPs by Path: {}", foundCPIds.size()); + } + + List foundCPs = competenceService.findAllContactPointsForCompetences(foundCPIds, selectedCompetences, department); + + log.debug("getNextDecisionPointOrContactPoints | foundCPs: {} - {}", foundCPs.size(), foundCPs.stream().map(ContactPointView::getId).collect(Collectors.toList())); + + List orderedResults = order(foundCPs,selectedCompetences); + + log.debug("getNextDecisionPointOrContactPoints | ordered results: {}", orderedResults.size()); + return new DecisionContactPointWrapper( orderedResults); } else { return new DecisionContactPointWrapper(result); } @@ -113,18 +126,19 @@ private static Competence getLastElement(List selectedCompetences) { return selectedCompetences.get(selectedCompetences.size() - 1); } - private List order( - List contactPointViews, List selectedCompetences) { + private List order(List contactPointViews, List selectedCompetences) { List order = relevanceService.getOrderOrNull(new HashSet<>(selectedCompetences)); - log.debug("getLastElement | contactPointViews size: {}", contactPointViews.size()); + log.debug("order | contactPointViews size: {}", contactPointViews.size()); + if (order == null) { return orderAlphabetically(contactPointViews); } else { Collections.sort(order); return order.stream() - .map(it -> findMatchingContactPoint(contactPointViews, it)) + .map(relevanceOrder -> findMatchingContactPoint(contactPointViews, relevanceOrder)) .filter(Objects::nonNull) + .peek(cp -> log.debug("order | stream: {}", cp.getId())) .collect(Collectors.toList()); } } @@ -137,20 +151,22 @@ private static List orderAlphabetically( } private static ContactPointView findMatchingContactPoint( - List contactPointViews, RelevanceOrder order) { + List contactPointViews, RelevanceOrder relevanceOrder) { + log.debug( "findMatchingContactPoint | contactPointViews {}; order: {}", - contactPointViews.toString(), - order.toString()); + contactPointViews.size(), + relevanceOrder.toString()); + ContactPointView view = contactPointViews.stream() - .filter(cp -> cp.getId().equals(order.getContactPointId())) + .filter(cp -> cp.getId().equals(relevanceOrder.getContactPointId())) .peek(cp -> log.debug("Filtered contactPointId: {}", cp.getId())) .findFirst() .orElse(null); if (view != null) { log.debug("Found matching contactPointId: {}", view.getId()); - view.setPosition(order.getPosition()); + view.setPosition(relevanceOrder.getPosition()); } return view; From 7d72349c63f62a15953762f73e8dab4c002e9c30 Mon Sep 17 00:00:00 2001 From: "jannik.lange" Date: Tue, 3 Dec 2024 15:06:27 +0100 Subject: [PATCH 23/25] updated relevanceservice --- .../relevance/service/RelevanceService.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/service/RelevanceService.java b/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/service/RelevanceService.java index ec857d5..249a54a 100644 --- a/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/service/RelevanceService.java +++ b/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/service/RelevanceService.java @@ -11,9 +11,12 @@ import de.muenchen.kobit.backend.decisiontree.relevance.view.RelevanceView; import java.util.*; import java.util.stream.Collectors; + +import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +@Slf4j @Service public class RelevanceService { @@ -48,13 +51,21 @@ public Set getAllRelevanceCompetencesByPathId(UUID pathId) return new HashSet<>(); } + public List getAllContactPointIdsByPathId(UUID pathId) { + return relevanceRepository.findAllByPathId(pathId).stream().map(Relevance::getContactPointId).collect(Collectors.toList()); + } + public List getOrderOrNull(Set competences) { Path path = findExistingPathOrNull(competences); if (path == null) { + log.debug("getOrderOrNull | path is null"); return null; } else { + log.debug("getOrderOrNull | path is: {}", path.getId()); + return relevanceRepository.findAllByPathId(path.getId()).stream() - .map(it -> new RelevanceOrder(it.getContactPointId(), it.getPosition())) + .map(relevance -> new RelevanceOrder(relevance.getContactPointId(), relevance.getPosition())) + .peek(relevanceOrder -> log.debug("getOrderOrNull | cpID: {}, position: {}", relevanceOrder.getContactPointId(), relevanceOrder.getPosition())) .collect(Collectors.toList()); } } @@ -117,6 +128,9 @@ private Path findExistingPathOrNull(Set selectedPath) { existingPaths.stream() .filter(it -> hasMatchingCompetences(it, selectedPath)) .collect(Collectors.toList()); + + log.debug("findExistingPathOrNull | found paths: {}", matchingPaths.size()); + if (!matchingPaths.isEmpty()) { return matchingPaths.stream() .findFirst() From 3ce2824bb5ce732cb871948fdd466f6b5336edce Mon Sep 17 00:00:00 2001 From: "jannik.lange" Date: Tue, 3 Dec 2024 15:28:29 +0100 Subject: [PATCH 24/25] :rotating_light: spotless --- .../competence/service/CompetenceService.java | 5 ++-- .../ContactPointManipulationService.java | 4 +-- .../service/DecisionTreeService.java | 30 +++++++++++++------ 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/main/java/de/muenchen/kobit/backend/competence/service/CompetenceService.java b/src/main/java/de/muenchen/kobit/backend/competence/service/CompetenceService.java index 2900195..36c916d 100644 --- a/src/main/java/de/muenchen/kobit/backend/competence/service/CompetenceService.java +++ b/src/main/java/de/muenchen/kobit/backend/competence/service/CompetenceService.java @@ -18,7 +18,6 @@ import java.util.Set; import java.util.UUID; import java.util.stream.Collectors; - import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.stereotype.Service; @@ -41,8 +40,8 @@ public class CompetenceService { this.mapper = mapper; } - public List findAllContactPointsForCompetences(List foundCPs, - List competences, String department) { + public List findAllContactPointsForCompetences( + List foundCPs, List competences, String department) { Set keys = new HashSet<>(foundCPs); return getMatchingContactPoints(department, keys).stream() diff --git a/src/main/java/de/muenchen/kobit/backend/contactpoint/service/ContactPointManipulationService.java b/src/main/java/de/muenchen/kobit/backend/contactpoint/service/ContactPointManipulationService.java index 2dbf3c8..7665122 100644 --- a/src/main/java/de/muenchen/kobit/backend/contactpoint/service/ContactPointManipulationService.java +++ b/src/main/java/de/muenchen/kobit/backend/contactpoint/service/ContactPointManipulationService.java @@ -88,7 +88,6 @@ public void updateContactPointCompetence(List competen * all competences COM of Path P 4. Subtract all competences (of 2.) from COM 5. Remove the * competences of 4. from the contactpoint A */ - List cpToUpdate = getContactPointsToUpdate(competenceViews, competences); log.debug("updateContactPointCompetence | CPs to update: {}", cpToUpdate.toString()); @@ -103,7 +102,8 @@ public void updateContactPointCompetence(List competen listItemToCompetenceView -> saveNewCompetencePair( listItemToCompetenceView.getListItem().getId(), - listItemToCompetenceView.getCompetences())); // set new competences for all + listItemToCompetenceView + .getCompetences())); // set new competences for all updateRelevance(competenceViews, competences); } diff --git a/src/main/java/de/muenchen/kobit/backend/decisiontree/service/DecisionTreeService.java b/src/main/java/de/muenchen/kobit/backend/decisiontree/service/DecisionTreeService.java index eed078a..21954bd 100644 --- a/src/main/java/de/muenchen/kobit/backend/decisiontree/service/DecisionTreeService.java +++ b/src/main/java/de/muenchen/kobit/backend/decisiontree/service/DecisionTreeService.java @@ -81,18 +81,27 @@ public DecisionContactPointWrapper getNextDecisionPointOrContactPoints( List foundCPIds = new ArrayList<>(); if (path != null) { - foundCPIds.addAll(relevanceService.getAllContactPointIdsByPathId(path.getId())); - log.debug("getNextDecisionPointOrContactPoints | found CPs by Path: {}", foundCPIds.size()); + foundCPIds.addAll(relevanceService.getAllContactPointIdsByPathId(path.getId())); + log.debug( + "getNextDecisionPointOrContactPoints | found CPs by Path: {}", + foundCPIds.size()); } - List foundCPs = competenceService.findAllContactPointsForCompetences(foundCPIds, selectedCompetences, department); + List foundCPs = + competenceService.findAllContactPointsForCompetences( + foundCPIds, selectedCompetences, department); - log.debug("getNextDecisionPointOrContactPoints | foundCPs: {} - {}", foundCPs.size(), foundCPs.stream().map(ContactPointView::getId).collect(Collectors.toList())); + log.debug( + "getNextDecisionPointOrContactPoints | foundCPs: {} - {}", + foundCPs.size(), + foundCPs.stream().map(ContactPointView::getId).collect(Collectors.toList())); - List orderedResults = order(foundCPs,selectedCompetences); + List orderedResults = order(foundCPs, selectedCompetences); - log.debug("getNextDecisionPointOrContactPoints | ordered results: {}", orderedResults.size()); - return new DecisionContactPointWrapper( orderedResults); + log.debug( + "getNextDecisionPointOrContactPoints | ordered results: {}", + orderedResults.size()); + return new DecisionContactPointWrapper(orderedResults); } else { return new DecisionContactPointWrapper(result); } @@ -126,7 +135,8 @@ private static Competence getLastElement(List selectedCompetences) { return selectedCompetences.get(selectedCompetences.size() - 1); } - private List order(List contactPointViews, List selectedCompetences) { + private List order( + List contactPointViews, List selectedCompetences) { List order = relevanceService.getOrderOrNull(new HashSet<>(selectedCompetences)); log.debug("order | contactPointViews size: {}", contactPointViews.size()); @@ -136,7 +146,9 @@ private List order(List contactPointViews, L } else { Collections.sort(order); return order.stream() - .map(relevanceOrder -> findMatchingContactPoint(contactPointViews, relevanceOrder)) + .map( + relevanceOrder -> + findMatchingContactPoint(contactPointViews, relevanceOrder)) .filter(Objects::nonNull) .peek(cp -> log.debug("order | stream: {}", cp.getId())) .collect(Collectors.toList()); From d70d387971e74c9527af2385d45292d2b81a281a Mon Sep 17 00:00:00 2001 From: "jannik.lange" Date: Tue, 3 Dec 2024 15:39:35 +0100 Subject: [PATCH 25/25] :rotating_light: spotless --- .../relevance/service/RelevanceService.java | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/service/RelevanceService.java b/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/service/RelevanceService.java index 249a54a..061803a 100644 --- a/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/service/RelevanceService.java +++ b/src/main/java/de/muenchen/kobit/backend/decisiontree/relevance/service/RelevanceService.java @@ -11,7 +11,6 @@ import de.muenchen.kobit.backend.decisiontree.relevance.view.RelevanceView; import java.util.*; import java.util.stream.Collectors; - import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -52,7 +51,9 @@ public Set getAllRelevanceCompetencesByPathId(UUID pathId) } public List getAllContactPointIdsByPathId(UUID pathId) { - return relevanceRepository.findAllByPathId(pathId).stream().map(Relevance::getContactPointId).collect(Collectors.toList()); + return relevanceRepository.findAllByPathId(pathId).stream() + .map(Relevance::getContactPointId) + .collect(Collectors.toList()); } public List getOrderOrNull(Set competences) { @@ -64,8 +65,16 @@ public List getOrderOrNull(Set competences) { log.debug("getOrderOrNull | path is: {}", path.getId()); return relevanceRepository.findAllByPathId(path.getId()).stream() - .map(relevance -> new RelevanceOrder(relevance.getContactPointId(), relevance.getPosition())) - .peek(relevanceOrder -> log.debug("getOrderOrNull | cpID: {}, position: {}", relevanceOrder.getContactPointId(), relevanceOrder.getPosition())) + .map( + relevance -> + new RelevanceOrder( + relevance.getContactPointId(), relevance.getPosition())) + .peek( + relevanceOrder -> + log.debug( + "getOrderOrNull | cpID: {}, position: {}", + relevanceOrder.getContactPointId(), + relevanceOrder.getPosition())) .collect(Collectors.toList()); } } @@ -124,6 +133,9 @@ private Set saveOrUpdateCompetences(Set selectedPath) { List existingPaths = pathRepository.findAll(); + log.debug( + "findExisitingPathOrNull | competences: {}", + selectedPath.stream().map(Competence::toString).collect(Collectors.toList())); List matchingPaths = existingPaths.stream() .filter(it -> hasMatchingCompetences(it, selectedPath))