diff options
| author | Felix Kehrer <felix.kehrer@gmail.com> | 2018-05-25 22:26:57 +0200 | 
|---|---|---|
| committer | Tharre <tharre3@gmail.com> | 2018-05-27 14:07:11 +0200 | 
| commit | b49423c1bc9e29f2066a74bb6f4fdb745a6db1b3 (patch) | |
| tree | 4e242c0d9ef9edbde4d8ae400aa642389951c725 /src | |
| parent | fad30d89e86cb9e72b4a3ee52027888ff245364d (diff) | |
| download | sepm-groupproject-b49423c1bc9e29f2066a74bb6f4fdb745a6db1b3.tar.gz sepm-groupproject-b49423c1bc9e29f2066a74bb6f4fdb745a6db1b3.tar.xz sepm-groupproject-b49423c1bc9e29f2066a74bb6f4fdb745a6db1b3.zip | |
add info messages for failed validations #27033
Diffstat (limited to 'src')
| -rw-r--r-- | src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/VehicleServiceImpl.java | 16 | 
1 files changed, 15 insertions, 1 deletions
| diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/VehicleServiceImpl.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/VehicleServiceImpl.java index 61a24e5..4e90582 100644 --- a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/VehicleServiceImpl.java +++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/VehicleServiceImpl.java @@ -11,12 +11,16 @@ import at.ac.tuwien.sepm.assignment.groupphase.exception.ServiceException;  import java.util.EnumSet;  import java.util.Set;  import java.util.stream.Collectors; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory;  import org.springframework.stereotype.Service;  import org.springframework.util.CollectionUtils;  @Service  public class VehicleServiceImpl implements VehicleService { +    private static final Logger LOG = LoggerFactory.getLogger(VehicleServiceImpl.class); +      private VehicleDAO vehiclePersistence;      public VehicleServiceImpl(VehicleDAO vehiclePersistence) { @@ -24,8 +28,10 @@ public class VehicleServiceImpl implements VehicleService {      }      public long add(Vehicle vehicle) throws InvalidVehicleException, ServiceException { -        if (!CollectionUtils.isEmpty(vehicle.registrations())) +        if (!CollectionUtils.isEmpty(vehicle.registrations())) { +            LOG.info("Invalid Vehicle: Vehicle cannot be created with registrations");              throw new InvalidVehicleException("Vehicle can't be created with registrations"); +        }          validateVehicle(vehicle);          try { @@ -52,32 +58,40 @@ public class VehicleServiceImpl implements VehicleService {          switch (vehicle.type()) {              case RTW:                  if (vehicle.constructionType() == ConstructionType.NORMAL) { +                    LOG.info("Invalid Vehicle: RTW cannot have a normal roof");                      throw new InvalidVehicleException("RTW darf kein Normales Dach haben");                  } else if (vehicle.constructionType() == ConstructionType.MITTELHOCHDACH) { +                    LOG.info("Invalid Vehicle: RTW cannot have a medium roof");                      throw new InvalidVehicleException("RTW darf kein Mittelhochdach haben");                  }                  break;              case KTW:                  if (vehicle.constructionType() == ConstructionType.NORMAL) { +                    LOG.info("Invalid Vehicle: KTW cannot have a normal roof");                      throw new InvalidVehicleException("KTW darf kein Normales Dach haben");                  }                  break;              case KTW_B:                  if (vehicle.constructionType() == ConstructionType.NORMAL) { +                    LOG.info("Invalid Vehicle: KTW-B cannot have a normal roof");                      throw new InvalidVehicleException("KTW-B darf kein Normales Dach haben");                  }                  break;              case NEF:                  if (vehicle.constructionType() == ConstructionType.MITTELHOCHDACH) { +                    LOG.info("Invalid Vehicle: NEF cannot have a medium roof");                      throw new InvalidVehicleException("NEF darf kein Mittelhochdach haben");                  } else if (vehicle.constructionType() == ConstructionType.HOCHDACH) { +                    LOG.info("Invalid Vehicle: NEF cannot have a high roof");                      throw new InvalidVehicleException("NEF darf kein Hochdach haben");                  }                  break;              case NAH:                  if (vehicle.constructionType() == ConstructionType.MITTELHOCHDACH) { +                    LOG.info("Invalid Vehicle: NAH cannot have a medium roof");                      throw new InvalidVehicleException("NEF darf kein Mittelhochdach haben");                  } else if (vehicle.constructionType() == ConstructionType.HOCHDACH) { +                    LOG.info("Invalid Vehicle: NAH cannot have a high roof");                      throw new InvalidVehicleException("NEF darf kein Hochdach haben");                  }                  break; | 
