From 1426adba7e44cefbd8e4579b0c5bd03be8a57605 Mon Sep 17 00:00:00 2001
From: Tharre <tharre3@gmail.com>
Date: Thu, 3 May 2018 20:00:55 +0200
Subject: Allow multiple registrations at once

Otherwise, proper validation wouldn't be possible.
---
 .../groupphase/einsatzverwaltung/dao/RegistrationDAO.java          | 7 ++++---
 .../groupphase/einsatzverwaltung/service/RegistrationService.java  | 7 ++++---
 2 files changed, 8 insertions(+), 6 deletions(-)

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

diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/RegistrationDAO.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/RegistrationDAO.java
index f2c461a..ba8f909 100644
--- a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/RegistrationDAO.java
+++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/dao/RegistrationDAO.java
@@ -3,6 +3,7 @@ package at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dao;
 import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Registration;
 import at.ac.tuwien.sepm.assignment.groupphase.exception.ElementNotFoundException;
 import at.ac.tuwien.sepm.assignment.groupphase.exception.PersistenceException;
+import java.util.List;
 
 public interface RegistrationDAO {
 
@@ -10,11 +11,11 @@ public interface RegistrationDAO {
      * Persist the given registration.
      *
      * @param vehicleId the id of the target vehicle
-     * @param registration that should be stored
-     * @return the id that was assigned
+     * @param registrations that should be stored
+     * @return a list of the ids that were assigned
      * @throws PersistenceException if the registration could not be persisted
      */
-    long add(long vehicleId, Registration registration) throws PersistenceException;
+    List<Long> add(long vehicleId, List<Registration> registrations) throws PersistenceException;
 
     /**
      * Make registration with the given id inactive.
diff --git a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/RegistrationService.java b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/RegistrationService.java
index 6723f32..801148c 100644
--- a/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/RegistrationService.java
+++ b/src/main/java/at/ac/tuwien/sepm/assignment/groupphase/einsatzverwaltung/service/RegistrationService.java
@@ -4,6 +4,7 @@ import at.ac.tuwien.sepm.assignment.groupphase.einsatzverwaltung.dto.Registratio
 import at.ac.tuwien.sepm.assignment.groupphase.exception.InvalidRegistrationException;
 import at.ac.tuwien.sepm.assignment.groupphase.exception.InvalidVehicleException;
 import at.ac.tuwien.sepm.assignment.groupphase.exception.ServiceException;
+import java.util.List;
 
 public interface RegistrationService {
 
@@ -11,13 +12,13 @@ public interface RegistrationService {
      * Register employee to a vehicle.
      *
      * @param vehicleId the id of the target vehicle
-     * @param registration that should be added to the vehicle
-     * @return the id that was assigned
+     * @param registrations that should be added to the vehicle
+     * @return a list of the ids that were assigned
      * @throws InvalidVehicleException if the vehicleId is invalid or does not exist
      * @throws InvalidRegistrationException if the registration is invalid
      * @throws ServiceException if the registration could not be persisted
      */
-    long add(long vehicleId, Registration registration)
+    List<Long> add(long vehicleId, List<Registration> registrations)
             throws InvalidVehicleException, InvalidRegistrationException, ServiceException;
 
     /**
-- 
cgit v1.2.3-70-g09d2