From 36f7e786ecf39d981d446ba00849c16e7707ba04 Mon Sep 17 00:00:00 2001
From: Felix Kehrer <felix.kehrer@gmail.com>
Date: Fri, 25 May 2018 20:56:44 +0200
Subject: changed log messages to be of format "Invalid Registration: <Problem
 description>" #27033

---
 .../dto/RegistrationValidator.java                 | 30 ++++++++++++----------
 1 file changed, 17 insertions(+), 13 deletions(-)

(limited to 'src/main/java/at')

diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dto/RegistrationValidator.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dto/RegistrationValidator.java
index 610426c..b3336b7 100644
--- a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dto/RegistrationValidator.java
+++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dto/RegistrationValidator.java
@@ -47,7 +47,9 @@ public class RegistrationValidator {
         for (Registration registration : registrations) {
             total++;
             if (found.put(registration.employee().id(), false) != null) {
-                LOG.info("Employee with ID {} was added twice", registration.employee().id());
+                LOG.info(
+                        "Invalid Registration: Employee with ID {} was added twice",
+                        registration.employee().id());
                 throw new InvalidRegistrationException(
                         "Person with the ID: "
                                 + registration.employee().id()
@@ -71,7 +73,7 @@ public class RegistrationValidator {
             }
         }
         if (total <= 0) {
-            LOG.info("No employees were added");
+            LOG.info("Invalid Registration: No employees were added");
             throw new InvalidRegistrationException("Kein Personal ausgewählt!");
         }
         if (vehicle.type() == VehicleType.NAH) {
@@ -83,10 +85,10 @@ public class RegistrationValidator {
             3-4 Personen
              */
             if (total < 3) {
-                LOG.info("Too few employees for NAH");
+                LOG.info("Invalid Registration: Too few employees for NAH");
                 throw new InvalidRegistrationException("Zu wenig Personal für NAH!");
             } else if (total > 4) {
-                LOG.info("Too many employees for NAH");
+                LOG.info("Invalid Registration: Too many employees for NAH");
                 throw new InvalidRegistrationException("Zu viel Personal für NAH!");
             }
             for (long pilot_id : pilotIds) {
@@ -103,7 +105,7 @@ public class RegistrationValidator {
                 }
                 found.put(pilot_id, false);
             }
-            LOG.info("No valid combination of employees found for NAH");
+            LOG.info("Invalid Registration: No valid combination of employees found for NAH");
             throw new InvalidRegistrationException(
                     "Keine gültige Kombination von Personen für NAH!");
         } else if (vehicle.type() == VehicleType.NEF) {
@@ -113,10 +115,10 @@ public class RegistrationValidator {
             1 NA
              */
             if (total < 2) {
-                LOG.info("Too few employees for NEF");
+                LOG.info("Invalid Registration: Too few employees for NEF");
                 throw new InvalidRegistrationException("Zu wenig Personal für NEF!");
             } else if (total > 3) {
-                LOG.info("Too many employees for NEF");
+                LOG.info("Invalid Registration: Too many employees for NEF");
                 throw new InvalidRegistrationException("Zu viel Personal für NEF!");
             }
             for (long driver_id : driverIds) {
@@ -130,7 +132,7 @@ public class RegistrationValidator {
                 }
                 found.put(driver_id, false);
             }
-            LOG.info("No valid combination of employees found for NEF");
+            LOG.info("Invalid Registration: No valid combination of employees found for NEF");
             throw new InvalidRegistrationException(
                     "Keine gültige Kombination von Personen für NEF!");
         } else if (vehicle.type() == VehicleType.BKTW) {
@@ -139,14 +141,14 @@ public class RegistrationValidator {
             1 Driver
              */
             if (total > 3) {
-                LOG.info("Too many employees for BKTW");
+                LOG.info("Invalid Registration: Too many employees for BKTW");
                 throw new InvalidRegistrationException("Zu viel Personal für BKTW!");
             }
             if (!driverIds.isEmpty()) {
                 LOG.info("Valid combination found for BKTW");
                 return;
             }
-            LOG.info("No driver was found for BKTW");
+            LOG.info("Invalid Registration: No driver was found for BKTW");
             throw new InvalidRegistrationException("Kein Fahrer gefunden für BKTW!");
         } else { // KTW or RTW, both have the same requirements
             /*
@@ -155,11 +157,11 @@ public class RegistrationValidator {
             1 RS
              */
             if (total < 2) {
-                LOG.info("Too few employees for {}", vehicle.type().name());
+                LOG.info("Invalid Registration: Too few employees for {}", vehicle.type().name());
                 throw new InvalidRegistrationException(
                         "Zu wenig Personal für " + vehicle.type().name() + "!");
             } else if (total > 4) {
-                LOG.info("Too many employees for {}", vehicle.type().name());
+                LOG.info("Invalid Registration: Too many employees for {}", vehicle.type().name());
                 throw new InvalidRegistrationException(
                         "Zu viel Persoanl für " + vehicle.type().name() + "!");
             }
@@ -171,7 +173,9 @@ public class RegistrationValidator {
                     return;
                 }
             }
-            LOG.info("No valid combination of employees found for {}", vehicle.type().name());
+            LOG.info(
+                    "Invalid Registration: No valid combination of employees found for {}",
+                    vehicle.type().name());
             throw new InvalidRegistrationException(
                     "Keine gültige Kombination von Personen für " + vehicle.type().name() + "!");
         }
-- 
cgit v1.2.3-70-g09d2